int w;
void function () {
- int x;
- int y;
-
- x = y;
-
- while () {
- int x;
- int z;
-
- y = z;
- x = z;
- w = z;
- }
- }
- class Base {
- public:
- Method1();
- Method2();
- };
- class Derived: public Base {
- public:
- Method1();
- Method3();
- }
- Base * b;
- Derived * d = new Derived;
- b = d;
- d->Method1();
- d->Method2();
- d->Method3();
- b->Method1();
- b->Method2();
- b->Method3();
- b = new Base;
- d->Method1();
- d->Method2();
- d->Method3();
- b->Method1();
- b->Method2();
virtual changes when the binding occurs.
virtual void myfunc() = 0;
class Bird {
public:
virtual Sing();
virtual Fly();
};
class Penguin: public Bird {
};
class Bird {
public
virtual Sing();
...
};
class FlyingBird: public Bird{
public:
virtual Fly();
}
class Penguin: public Bird {
};