#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 get different errors:
error: 'int B::a' is private
error: 'int A::a' is inaccessible
Apart from what the errors might reveal, is there any difference at all in the behaviour of these two pieces of code?