+ 1

Abstract Class

If I inherit from abstract class can I define a new function in child class that does not exist in parent class? check this out https://code.sololearn.com/c5KQ8EpLfQ7I

13th Aug 2021, 11:19 PM
Eyob
Eyob - avatar
2 ответов
+ 4
"Can I define a new function in child class that doesn't exist in parent class? Yes, but here that is not the issue. <D> is a pointer to `Animal` object not `Dog` object. So the call to `onlyDogThing()` method which was defined only in `Dog` class fails.
14th Aug 2021, 12:54 AM
Ipang
+ 1
Thanks.
14th Aug 2021, 7:33 PM
Eyob
Eyob - avatar