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

Mind map

Inheritance

John Poulos Computer Science English

Inheritance

Map content

Inheritance

  1. Extending a class or subclassing or inheriting a class using keyword 'extends'

    • Inheritance allows you to add methods that don't exist in the original class while still retaining the original features.
      • Java does not inherit from multiple classes. Can't extend a class from two different classes.
        • Interface gets around this issue and supports the functionality of multiple inheritance.
      • Can continue to subclass as needed. The final keyword prevents further subclassing.
        • Multilevel inheritance has limits to access to distant classes. Grandparent ---> Parent ----> Child Child has no access to grandparent.
  2. ·

    • Line points towards generalization.
  3. extends used in code: public class Parent {}

    • public class Child extends Parent {}
      • All Java classes automatically extend java.lang.Object Class
      • Parent class is a subclass to Object class in Java
      • As-Is Relationship: Animal (parent class) <--- Fox(child class)
  4. Accessibility

    • From inside a subclass, you can use the parent class's public and protected methods and fields. You can not use the private methods. If both parent and child classes are in the same package, the child can also access the parent's default methods and fields.
    • Method Overriding
      • When the child class's methods are used in place of the parent class. This is done by using the same name and allows Java to have runtime polymorphism, the ability to change functionality depending on which class's method is used.
    • Method Overloading
      • This allows a class to have more than one method with the same name but with different parameters. This increases readability of the code.
  5. Typecasting

    • You can change the type of the subclass to the parent class's type. Also known as upcasting.

Images and files in the map

  • Inheritance

Information

Description
Computer Science Mind Map on Inheritance, created by John Poulos on 04/08/2019.
Created by
John Poulos
Views
0
History
  • Created by John Poulos · Aug 3, 2019
  • Copied by John Poulos · Aug 3, 2019
  • Copied by John Poulos · Aug 4, 2019
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?