Pergunta de entrevista da empresa Revature

Could you provide an example of inheritance?

Resposta da entrevista

Sigiloso

12 de jul. de 2017

Inheritance is where something (typically an object) inherits some type of value or attribute from something else (typically a class or an interface). One example would be an object instance with the name smallRect, which would be an instance of the rectangle class, and inherit the values of length and height. Each instance of the rectangle class would inherit the properties of height and width, although the exact value of height and width will probably be different for each instance that is created. The objects would probably also inherit getter and setter methods from the rectangle class.