GoConqr has a new look! Let us know what you think.

Mind map

Inheritance

Jada Matthews English

Map content

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.

Information

Description
Mind Map on Inheritance, created by Jada Matthews on 21/11/2019.
Created by
Jada Matthews
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?