Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- class B
- {
- public:
- int x;
- B(int v = 0) : x(v) {}
- virtual void f(int a = 1, int b = 2) {printf("\n%d", a);}
- };
- class D : public B
- {
- public:
- D(int v) : B(v) {}
- void f(int a = 3, int b = 4) {printf("\n%d", a);}
- };
- int main()
- {
- B b, *pb;
- D d(15);
- pb = &d;
- pb->f(10,20);
- b.f();
- pb->f();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment