If class Aardvark derives from class Animal, and it replaces the inherited output() function, which version of the outpu
Posted: Fri May 20, 2022 5:31 pm
If class Aardvark derives from class Animal, and it replaces the inherited output() function, which version of the output() function gets called in the following 2-line code segment? Animal* a = new Aardvark; a->output(); it's a trick question! This code will not compile, because the data types do not match in the first line Animal::output is called, because of the data type declared for a Aardvark::output is called, because the object is an Aardvark it depends on the original declaration of the output function in the Animal class