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

Mind map

Chapter 6

Ralph Eubanks English

Map content

Chapter 6

  1. INHERITANCE

    • Inheritance is what makes code extensible in any OOP language
    • The process of extending a class
      • extend a class by using the "extends" keyword in class declaration
      • extending a class is known as inheriting / subclassing
        • use the "final" keyword to prevent classes from being subclassed
        • extend a class by creating a new class
          • "new" keyword creates an instance of a subclass
            • keyword "super" represents an instance of the direct superclass of the current object
              • you can explicitly call the parents constructor from a subclass’s constructor with super keyword, super must be first statement in the constructor
              • super can call a hidden member or an overridden method in a superclass
            • "instanceof" keyword used to test if an object is of a specified type typically used in an if statement
        • subclass inherits all public methods and fields of its superclass
          • you can access a superclass public and protected methods and fields within the subclass, but you cannot access the private methods
        • method overriding - changing the behavior of a method in the parent class by writing in a subclass a method with the same signature as a method in the superclass
          • method overloading - only the name is the same but the list of arguments is not
      • “is-a” relationship is when you create a new class by inheritance
    • Gives you the opportunity to add functionality that does not exist in the original class
    • gives you the chance to change the behaviors of the existing class to better suit your needs

Information

Description
Mind Map on Chapter 6, created by Ralph Eubanks on 26/11/2019.
Created by
Ralph Eubanks
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?