How can protected-members of the base class be made accessible from the class derived from it?

The question is a bit misleading IMO. Does this case falls under the problem's condition? class A { protected: const int a = 3; }; class B : A { void foo() { std::cout << a << std::endl; };

2019 Jan 11, 4:52:53 PM

@oleksiimld80 thanks!

2017 Dec 5, 3:41:41 PM

Missed word "using " in answer

2017 Nov 26, 11:46:20 AM

C++
C++ Quiz
Start Quiz

or Read more about C++ Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback