Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Base
- {
- public:
- virtual void func(int x, float y, unsigned z) = 0;
- void func(int x)
- {
- cout << "func with x only" << endl;
- }
- };
- class Derived : public Base
- {
- public:
- void func(int x, float y, unsigned z)
- {
- cout << "func override" << endl;
- }
- };
- int main()
- {
- Derived d;
- d.func(10); // <<--------- 'COMPILATION ERROR'
- return 0;
- }
- error: no matching function for call to 'Derived::func(int&)'
- note: candidates are: virtual void Derived::func(int, float, unsigned int)
- using Base::func;
- int main()
- {
- Base && b = Derived();
- b.func(10);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement