¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Inheritance

Jada Matthews Inglés

Contenido del mapa

Inheritance

  1. Overview

    • An important feature in OOP used to extend a class.
      • Use the "extends" keyword after class name and before parent
        • Example: public class Child extends Parent{}
          • Multiple inheritance is allowed in C++ unlike JAVA.
    • Parent-Child Relationship between classes.
      • The child class can be extendable until you declare it as "final"
        • Use "final" keyword to prevent classes from being subclassed or extended.
    • Allows you to change behaviors of an existing class to better suit your needs.
  2. "Is-A Relationship"

    • A special relationship between the superclass and the subclass.
      • Superclass being a big class and the subclasses are the different types of the superclass.
      • Must not assign an instance of a subclass to a reference variable of the parent type.
      • A subclass inherits all public methods and fields from the superclass.
  3. Accessibilty

    • Have access to superclass's public methods and fields.
  4. Method-Overiding

    • By extending a class, you change the method's behavior within the parent class.
    • Write in the subclass a method that has the same signature as it does in the parent class.
    • Method-Overloading
      • Only the name is the same, and the list of argument isn't.
    • You can not override a final method
  5. Type Casting

    • Cast an object to another type
      • Only can cast an instance of a subclass to its parent.
    • Casting an object to a parent class is called upcasting.

Información

Descripción
Mapa Mental sobre Inheritance, creado por Jada Matthews el 21/11/2019.
Creado por
Jada Matthews
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?