Page 1 of 1

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
by answerhappygod
If Class Aardvark Derives From Class Animal And It Replaces The Inherited Output Function Which Version Of The Outpu 1
If Class Aardvark Derives From Class Animal And It Replaces The Inherited Output Function Which Version Of The Outpu 1 (71.66 KiB) Viewed 43 times
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