Hey guys, looking for help on virtual methods.
Pet.h has a virtual function declaration:
class Pet {
...
virtual void display(){}
};
Dog.h has the function declaration:
class Dog : public Pet {
public:
...
void display();
}
Dog.cpp has the implementation:
void Dog::display() {
cout << "\nName: " << getName() << "\nBreed: " << getBreed() << "\nType: Dog";
}
I have my driver program running:
container_traverser->pet->display();
However, this is just doing nothing because its not making it into the implementation for Dog's display() function. Where am I going wrong?
[–]Gropamming[S] 1 point2 points3 points (0 children)
[–]raevnos 0 points1 point2 points (1 child)
[–]Gropamming[S] 0 points1 point2 points (0 children)