what is the default visibility mode of classes during inheritance (here for B in D@ class)
class B {
public:
int key;
B(void) { key = 0; printf("B constructed\n");}
virtual void Tell(void);
~B(void) {cout <<"B destroyed"<<endl << endl;}
};
class D2 : B {
public:
void Tell(void) { printf("D2 Here\n"); }
};
The default for when you use class
is private
, the default for when you use struct
is public
.
So this:
class D2 : B {
is equivalent to
class D2 : private B {
private:
and this:
struct D2 : B {
would be equivalent to
struct D2 : public B {
public:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With