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

Mind map

(6) Concepts In OOP (ITI1121)

gargantua iti1121 finals English

(6) Concepts In OOP (ITI1121)

Map content

(6) Concepts In OOP (ITI1121)

  1. (1) OOP and Encapsulation

  2. (2) Polymorphism and Inheritance

    • Inheritance
      • To inherit from another class...
        • public class Subclass extends Parent { ... }
      • Java only has single-inheritance
        • Object has no parent
      • A subclass can...
        • Add new methods
        • Override and hide parent methods
          • Overrides instance method
            • Whether it is invoked from a subclass or a parent class, the method that will get called is always the one from the SUBCLASS
          • Hides static method
            • That is to say, hides it from the parent object.
            • If invoked from subclass, the subclass static method is called
            • If invoked from parent class, the superclass static method is called
      • Using the keyword final, we can prevent subclasses from overriding methods
      • An attribute declared private cannot be accessed by child class
        • Circumvent this with the keyword protected
      • super()
        • Explicit call to immediate super class's constructor
        • Can only be first statement of constructor
        • Can only appear in constructors
        • If the first statement of a constructor is not super(), java automatically inserts a call to super.
          • The super class must have a constructor with an arity of 0, or else a compiler error will occur.
          • The default arity 0 constructor is no longer present if a constructor is defined
      • Inheritance allows you to re-use code, fixing a bug in the superclass will fix all subclasses
      • Dynamic binding (virtual, late)
        • Method names are searched from bottom-to-top at run time
    • (2) Types of Polymorphism
      • A variable or method is polymorphic if it refers to objects of more than one class
      • (1) Ad hoc (overloading)
        • Several methods or constructors with the same name can be added to a class as long as their signatures are different (return type and arguments)
        • Same name, different signatures.
        • Operator overloading
          • Some operators like + are overloaded, but a user cannot overload an operator.
      • (2) Inclusion (subtyping, data)
        • An instance variable of the superclass can hold any reference to one of its subtypes
          • However, the superclass variable now loses all references to methods defined in subtypes.
            • Even if the method gets "hidden" by overriding a static method, Java will still call the static method from the superclass.
        • A class that has an abstract method must be abstract (public abstract class...)
          • One cannot create an object of an abstract class.
          • An abstract method MUST be declared by any sublcass that wants to inherit
  3. (3) Polymorphism and interfaces

    • Implementation
      • public interface comparable { ... }
      • The implementation must provide every single method and variable in an interface
        • public class Implementation implements Interface1. Interface2,... {... }
        • It's possible to implement multiple interfaces
    • It's possible to have a reference variable to an interface -- it can hold any class that implements the interface.
      • However, we cannot call any methods through it.
    • Properties, uses...
      • Designates a list of public methods and variables of a class
      • Implements the relationship "can be seen as" as opposed to "is a". It can be seen as a contract.
      • Formalism used to express abstract data types
  4. (4) Abstract Data Types

    • Queue
    • List
    • Stack
  5. (5) Iterators

  6. (6) Binary Search Tree

Images and files in the map

  • (6) Concepts In OOP (ITI1121)

Information

Description
finals iti1121 Mind Map on (6) Concepts In OOP (ITI1121), created by gargantua on 07/04/2015.
Created by
gargantua
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?