R
Rahul
Hi Everyone,
I have the following polymorphic classes,
class Shape
{
public : virtual void draw()
{
}
virtual void sample();
};
class Circle : public Shape
{
public : virtual void draw()
{
cout<<"Circle::draw"<<endl;
}
};
int main()
{
Shape *ptr = new Circle;
ptr->draw();
return(0);
}
and i get a linker error saying undefined external sumbol __sample...
But i haven't really invoked the function sample(). Note that the code
works fine when i change sample() to a non-virtual function prototype,
why is this the case?
Thanks in advance ! ! !
I have the following polymorphic classes,
class Shape
{
public : virtual void draw()
{
}
virtual void sample();
};
class Circle : public Shape
{
public : virtual void draw()
{
cout<<"Circle::draw"<<endl;
}
};
int main()
{
Shape *ptr = new Circle;
ptr->draw();
return(0);
}
and i get a linker error saying undefined external sumbol __sample...
But i haven't really invoked the function sample(). Note that the code
works fine when i change sample() to a non-virtual function prototype,
why is this the case?
Thanks in advance ! ! !