add tag
I want use method of base class when my derived class has method with the same name but with different arguments. 

If I just try to call base method I've got a compile time error:

> *.cpp: In function 'int main()':  
> *.cpp:25:11: error: no matching function for call to 'Derived::foo()'  
>            ^  
> *.cpp:13:7: note: candidate: 'void Derived::foo(int)'  
>   void foo(int c)  
>        ^~~  
> *.cpp:13:7: note:   candidate expects 1 argument, 0 provided  
> Compilation failed.

Here is code:

    #include <iostream>

    struct Base
	    void foo()
		    std::cout<<"Base foo\n";
    struct Derived : public Base
	    void foo(int c)
		    std::cout<<"Derived foo";
    int main()
       Derived p1;;

So how to access the base method if derived method is hiding the base one?
Top Answer
Using syntax `[OBJECT].[BASE_CLASS]::[METHOD]`


Try in [](

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.