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

Mind map

Inheritance

John Hair English

Map content

Inheritance

  1. Hierarchies

    • Parent Class: Also known as the super class, gives the child class (sub class) methods and variables.
    • Child Class: Also known as the sub class, it takes the methods and variables from the super class. Thanks to polymorphism, can be casted to the super class type. It uses the extends keyword.
  2. Inheriting Fields and Methods

    • Sub classes automatically inherit methods and fields. You can not use the same name for a instance variable that is already used in the super class, but you can overwrite a method to fit the sub class better.
  3. Subclass construction

    • Created just like a regular class, but uses the extends keyword followed by the
  4. Converting between subclasses and superclasses: Objects of Subclasses can convert to superclasses, but objects of super classes can not be converted to sub classes.

  5. Super(): is used in the constructor of the child class to give the parent class the required parameters

  6. Abstract Classes: Classes that have one or more abstract methods with at least one regular method. When a sub class extends an abstract class, they must write the code for the abstract methods.

  7. Access control

    • Public: Available to all classes in the same package
    • Private: Available to only the class it is created in, requires accessor method to get.
    • Protected: Protected data in an object can be accessed by the methods of the object’s class and all its subclasses.
  8. Super: keyword that can be used to call methods of the superclass

  9. Object Super class: Default extension when creating a class. Methods can be overwritten.

    • toString: returns a string of the location in memory
    • equals: sees if the two objects have the same location in memory

Information

Description
Mind Map on Inheritance, created by John Hair on 03/05/2018.
Created by
John Hair · May 2018
Updated
May 3, 2018
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?