V
Vajira
Hello,
Can you tell me why compilar does not recognize base class's virtual
function in the following code? Is there is any limitation in C++,
related to overloading virtual function of a base class in the derived
class ?
Compilar printed following message >
g++ main2.cpp
main2.cpp: In function `int main()':
main2.cpp:21: no matching function for call to `B:isplay(int)'
main2.cpp:13: candidates are: virtual void B:isplay()
Sample code --
#include <iostream>
using namespace std;
class A
{
public:
virtual void Display(int a) { cout << "Class A param " << a <<
endl;};
};
class B : public A
{
public:
virtual void Display() { cout << "Class B "<< endl;};
B(){;};
};
int main(void)
{
B* b = new B;
b->Display(10);
return 0;
}
Can you tell me why compilar does not recognize base class's virtual
function in the following code? Is there is any limitation in C++,
related to overloading virtual function of a base class in the derived
class ?
Compilar printed following message >
g++ main2.cpp
main2.cpp: In function `int main()':
main2.cpp:21: no matching function for call to `B:isplay(int)'
main2.cpp:13: candidates are: virtual void B:isplay()
Sample code --
#include <iostream>
using namespace std;
class A
{
public:
virtual void Display(int a) { cout << "Class A param " << a <<
endl;};
};
class B : public A
{
public:
virtual void Display() { cout << "Class B "<< endl;};
B(){;};
};
int main(void)
{
B* b = new B;
b->Display(10);
return 0;
}