Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- struct Base {
- virtual void f() {
- std::cout << 1;
- }
- };
- struct Derived: Base {
- virtual void f() {
- std::cout << 2;
- }
- };
- struct Subderived: Derived {
- void f() {
- std::cout << 3;
- }
- };
- int main() {
- Derived d;
- Base& b = d;
- b.f();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement