Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class Base {
- public:
- void methodA() {
- std::cout << "Base::methodA" << std::endl;
- }
- };
- class Derived : public Base {
- public:
- void methodA() {
- std::cout << "Derived::methodA" << std::endl;
- }
- };
- int main( int argc, char **argv )
- {
- Derived obj;
- Base* ptr = &obj;
- ptr->methodA();
- obj.methodA();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement