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

Mind map

Inheritance

Alyssa M. English

Inheritance

Map content

Inheritance

  1. The process of extending a class

  2. The child classes inherit all of the methods and fields of the parent class. The child classes can also have new methods and fields as well as the ability to override existing methods from the parent class.

    • Child classes can also be extended to become the "parent" class to another class
      • For a child class to inherit the methods and fields of the parent class, it should be declared using the extends keyword
        • When a class is created by inheritance, the superclass and subclass class have a "is-a" relationship
          • In this example: A Rectangle (Subclass) "is-a" Shape (Superclass) and a Triangle (Subclass) "is-a" Shape (Superclass)
        • Method Overriding
          • A subclass can override a method from its superclass by having a method of the same name and parameters within it
        • Method Overloading
          • A subclass can overload a method from its superclass by having a method of the same name and different within it
      • public class Parent{ }
        • public class Child1 extends Parent { }
        • public class Child2 extends Parent { }
      • This can be achieved using interfaces since a class can only extend one class in Java
    • A class can be declared as final if you no longer want it to be extendible or inherited by a subclass

Images and files in the map

  • Inheritance
  • Inheritance

Information

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

Feedback

What is it about?

What do you think of the new look?

How do you like it?