Object-Oriented Programming:

Inheritance

  • Classes may derive from existing classes.
  • Derive - Specialize the "parent" class.
  • "is a" relationship

Polymorphism

  • Method Overriding - Modifying a method in the derived class
  • Implemented w/ Virtual & Overridden methods
Class Book {
  public virtual double Discount();
}

Class Fiction: Book {
  public override double Discount(){
    //   this would be the parent's Discount method.
    base.Discount();
  }
}

Encapsulation

  • Each class has a single area of responsibility
  • Most of the internals of the class are private, with a few well-defined properties & methods that are public.

results matching ""

    No results matching ""