Qualcomm Interview Question

How would you decide when to use Inheritance and when to create object. (difficult for me because I have no experience in object oriented programming)

Interview Answer

Anonymous

Oct 9, 2012

You meant inherit from a class vs. create a new class (instead of object), right? Just use the "is a" relationship. It's really all a matter of whether it logically makes sense to inherit (for example a dog should definitely inherit from an animal class if it exists, since dog has all the existing traits of an animal- a dog "is an" animal).