Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Base.h
- #pragma once
- class Base
- {
- public:
- void foo();
- virtual void bar();
- };
- //Base.cpp
- #include "Base.h"
- void Base::foo()
- {
- }
- //Derived.h
- #pragma once
- #include "Base.h"
- class Derived : public Base
- {
- public:
- void bar() override;
- }
- //Derived.cpp
- #include "Derived.h"
- void Derived::bar()
- {
- }
- //main.cpp
- #include "Derived.h"
- int main(/**/)
- {
- Derived d;
- Base* ptr = &d;
- d->foo();
- d->bar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement