#include<stdio.h>
class A {public: int a; };
class B: public A {private: int a;};
int main(){
B b;
printf("%d", b.a);
return 0;
}
#include<stdio.h>
class A {public: int a; };
class B: private A {};
int main(){
B b;
printf("%d", b.a);
return 0;
}
I ask because I have different errors:
error: 'int B::a' is private
error: 'int A::a' is inaccessible
In addition, that errors can be detected, is there any difference in the behavior of these two parts of the code?
source
share