0

How Is it possible to access the private member of a base class in the derived class in c++

3rd Jun 2021, 2:05 PM
steadson allen
steadson allen - avatar
2 Antworten
+ 1
#include <iostream> using namespace std; class A{ private: int x = 10; public: void show(){ cout<<x; } }; class B:public A{}; int main() { B b; b.show(); return 0; }
3rd Jun 2021, 2:10 PM
TOLUENE
TOLUENE - avatar