OOP

OOP

Object oriented programming

overriding

overriding is when a method in a subclass has the same name as a method in the parent class. The consequence is that when called the new subclass method will be executed, instead of the parent method.

multi-method

multi-method dispatch allows different methods to have the same name, but different signatures (different argument types, different number of arguments). The resolution happen at runtime.

overloading

overloading allows different methods to have the same name, but different signatures (different argument types, different number of arguments). The resolution happen at compile time. It is a special case of multi-method dispatch.

constructor

Constructors are special methods in a class definition used to initialize an Object upon its creation.

cast

Casting : Explicit or Implicit type conversion between similar Types or Classes. If types/classes are not similar i.e. not in the same hierarchy then you have to do a conversion.

:variable

Variables purpose is to hold values, like a box holding objects. Variables have type, scope and can be mutable or immutable. Class and objects variables are called attributes.

:attribute

  • Attributes are variables belonging to a Class or an Object
    • Class variables are accessible by all the Objects instantiated from the Class
    • Object variables are accessible only to the object

:method

Method is a function that have access to the Object internal variables/attributes

:class

Class is the description and implementation of the bundle of data (:attributes) and behavior (:methods)