0
How Is it possible to access the private member of a base class in the derived class in c++
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;
}