S
Shelly Adhikari
class B {
public:
B() { }
~B() { }
protected:
int abc;
void g() {}
};
class C : public B {
public:
void f(B* p) {
p->g(); // Should this be an error?
int m = p->abc; // Should this be an error?
int n = abc;
g();
}
};
int main() {
B* y = new B();
C x;
x.f(y);
}
If you could also point me to the ISO C++ standard section and page
number, it would be great.
public:
B() { }
~B() { }
protected:
int abc;
void g() {}
};
class C : public B {
public:
void f(B* p) {
p->g(); // Should this be an error?
int m = p->abc; // Should this be an error?
int n = abc;
g();
}
};
int main() {
B* y = new B();
C x;
x.f(y);
}
If you could also point me to the ISO C++ standard section and page
number, it would be great.