Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- В следующем примере отметьте, что напечатает данная программа:
- class A {
- public:
- void f() { cout<<”A::f”<<endl; }
- virtual void g() {cout<<”A::g”<<endl;}
- };
- class B: public A {
- public:
- void f() { cout<<”B::f”<<endl; }
- virtual void g() {cout<<”B::g”<<endl;}
- };
- int main() {
- A a = B();
- a.f();
- a.g();
- B b;
- A &ra = b;
- ra.f();
- ra.g();
- A *pa = new B();
- pa->f();
- pa->g();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement