O GoConqr está de visual novo! Conte para nós o que você achou.

Mapa mental

Inheritance, extending a class

kiara thompson Inglês

Conteúdo do mapa

Inheritance, extending a class

  1. Parent Class/ base class/superclass/orginal class

    • The object is the ultimate superclass
    • "Is-a" relationship with subclass
      • Consequence of this relationship is that it is legal to assign an instance of subclass to reference variable of parent type
        • Example: Animal animal = new Bird();
    • If constructor is not explicitly written in subclass, the compiler will implicitly add a no argument constructor
  2. Child class/subclass/ derived of parent class

    • Add new method/fields, and override existing methods to change behaviors
    • Can be extended unless made inextensible by declaring it final
    • Special type of the superclass
    • inherits all public methods and fields of superclass.
    • Not able to access the private methods of superclass
    • Able to access default methods and fields, if superclass and subclass are in the same model
    • use new to create an instance of class
    • Type Casting: ability to cast an object to another type; rule is you can only cast an instance of a subclass to its parent class
  3. Inheritance allows one to add some funcationality that does not exist in orginal class

    • To extend a class use the keyword "extend" keyword in class declaration; only one class can be extended in Java.
  4. Method Overriding: changing the behavior of a method in parent class through extending a class

    • Happens when method in subclass has the same signature as method in parent class

Informações

Descrição
Mapa Mental sobre Inheritance, extending a class, criado por kiara thompson em 21-11-2019.
Criado por
kiara thompson
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?