I have following code snippet:
using namespace std;
class base
{
public:
virtual void print(char a){ std::cout<<" Base "<<std::endl;}
};
class derived :public base
{
public:
void print(floata) {std::cout<<" Derived "<<std::endl;}
};
int main()
{
base* d = new derived;
d->print(1.5);
return 0;
}
Output is "base" Why output is coming from base function and not from derived one
Aucun commentaire:
Enregistrer un commentaire