Jump to content

C++ Polymorphism explanation questionable


JBR

Recommended Posts

Hi,

I've been teaching C++ and OO for 20 years and stumbled over this:

https://www.w3schools.com/cpp/cpp_polymorphism.asp

Where is the polymorphism?

My second line is a polymorphic call.

Animal *pAnimal = new Pig();

pAnimal->animalSound();

IMO your code is misleading and not useful.

Please contact me to discuss.

John

Link to comment
Share on other sites

I'm not certain how frequently the staff visits the forum, but I'd say less than once a year. If you find an error on any page you can click the "REPORT ERROR" button at the bottom of that page to send a notice to the site owners.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...