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

Mind map

Inheritance

Ivan Mitevski English

Map content

Inheritance

  1. The process of extending a class in OOP

  2. Gives you the opportunity to add some functionality that does not exist in the original class

  3. Gives the chance to change the behaviors of the existing class to better suit your needs

  4. Extends Keyword

    • Used to extend a class
    • A class can only extend one class
    • Placed in class declaration
  5. Is-a relationship

    • Relationship formed when you create a new class by inheritance
    • Subclass inherits methods from superclass
    • You can assign an instance of a subclass to a reference variable of the parent type
  6. Accessibility

    • In a subclass, the superclass's public and protected methods and fields can be accessed
    • Protected Method
      • Not accessible from outside class except from a subclass
  7. Method Override

    • When extending a class, the behavior of the method of the parent method can be changed
    • To override, write the new method in the subclass
  8. Calling Superclass constructors

    • First thing constructor does is call the no-argument constructor of the direct parent class
    • Process repeats until the constructor of the object class is reached
    • Super Keyword
      • An instance of the direct superclass of the current object
  9. Calling Superclass Hidden Members

    • Super Keyword
      • Used to call a hidden member or an overridden method in the superclass
  10. Type Casting

    • Upcasting
      • Casting an object to a parent class
      • Assign the object to a reference variable of the type Superclass
    • Downcasting
      • Casting an object to a class down
      • Write the child type in brackets
  11. Final

    • Prevents others from extending your class by making it final
  12. instanceof Keyword

    • Used to test if an object is of a specified type

Information

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

Feedback

What is it about?

What do you think of the new look?

How do you like it?