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

Mind map

Inheritance

Ana Ausek English

Map content

Inheritance

  1. Code Extensibility

    • extends keyword; Java only allows 1 extension per class
      • Create new class; subclass
        • Parent-child relationship
          • Method Override
            • Write method with same signature as parent class method
              • Change existing method behaviors
          • Child has "is-a" relationship to Parent
            • Child inherits all public methods of Parent
              • Allows reference variable of parent type in assignment of a subclass instance
                • Subclass can access public and protected just not private methods from superclass
        • keyword new to create an instance
          • When subclass object is instantiated, so are all parent's classes
      • Ex: public class Child extends Parent {}
    • final keyword
      • Prevent method override; no change in behavior allowed
      • Does not permit Method Override
        • Speed improvement but design should be main concern
      • Ex: public final class Pencil{}
    • java.lang.Object
      • Ultimate Java superclass
    • keyword super represents instance of direct superclass of current object
      • Invoke superclass constructor
      • Call a hidden member or an overriden superclass method
    • Type Casting
      • Possible only to cast subclass instance to parent class; "Upcasting"
        • "Downcasting" if parent instance is cast as child class
    • instanceof keyword
      • test if object is of specified type; ex: if it's type of its superclass

Information

Description
Mind Map on Inheritance, created by Ana Ausek on 03/08/2019.
Created by
Ana Ausek
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?