blob: 272b341208522ba895dc24ff67b8c921fa58f74c (
plain) (
tree)
|
|
#include <iostream>
class A {
public:
virtual void f();
};
class B : public A {
public:
void f();
};
void A::f() {
std::cout << "this is A::f" << "\n";
}
void B::f() {
std::cout << "this is B::f" << "\n";
}
int main() {
A *a = new A();
a->f();
a = new B();
a->f();
}
|