INHERITANCE, POLYMORPHISM AND INTERFACES

Cards (16)

  • ·       enables the use of existing class to define a new class.
    INHERITANCE
  • ·       It is also known as subclass, child class, and descendant class.
    DERIVED CLASS
  • A derived class is defined by adding instance variables and methods to an existing class.
  • The existing class that the derived class is built upon is called the base class
  • ·       It is also called superclass, parent class, and ancestor class.
    BASE CLASS
  • ·       If a derived class defines a method with the same name, the same number and types of parameters, and the same return type as a method in the base class, the definition in the derived class is said to override the definition in the base class.
  • A derived class has its own constructors
  • ·       A derived class has its own constructors. It does not inherit any constructors from the base class.
  • ·       is the ability of an object to take on many forms.
    Polymorphism allows you to make changes in the method definition
    POLYMORPHISM
  • ·       allows you to make changes in the method definition for the derived classes and have those changes apply to the methods written in the base class.
    polymorphism
  • ·       allows many meanings to be associated to one method name.
    dynamic binding
  • is used to specify methods that a class must implement. It contains headings for a number of public methods.
    interface
  • ·       should include comments that describe the methods.
    interface
  • cannot be instantiated but can be subclassed

    abstract class
  • is a method that is declared as abstract and does not have an implementation. This is written without braces, followed by a semicolon

    abstract method
  • ·       They both cannot be instantiated and may contain a mix of methods declared with or without an implementation.
    abstract and interface