Object-Oriented programming (OOP) is an important paradigm in programming. It is the concept of using classes and objects to model the real world. Classes are sets of data fields, together with methods (which hold a functionality to interact with the data fields and other objects). They define the structure of information objects: the data they hold and the operation they can perform. Objects are instances of the classes, holding certain values in their data fields.
Â
Classes and objects are the building blocks of the object-oriented programming (OOP) and they come together with some other OOP concepts like abstraction, interfaces, data encapsulation, inheritance, polymorphism and exception handling.
- Inheritance allows classes to inherit data and functionality from a parent class (also called “base class”). When a class inherits another class, the parent class fields are merged with the child class fields and they together form the set of data fields for the child class.
- Interfaces define abstract actions. These are actions to be implemented in the descendent classes. Interfaces define a set of empty (or abstract) methods (or actions), which shall be obligatory to be implemented in the child classes. Interfaces are also called “contracts“, because they define а certain set of functionalities, a contract to implement certain methods.
- Abstract classes are used to model abstractions. Abstract classes define data + actions (or normal methods) + abstract actions (or empty methods). Abstract classes are designed to be inherited (or extended).
- Concrete classes represent real entities, not abstractions. Concrete classes define data fields + concrete functionality (methods). They can implement interfaces and inherit abstract and other classes.
Lesson Topics
In this video we review the following topics:
- What is OOP?Â
- Demo of OOP in JavaScript and C#
- Class Inheritance – Interfaces, Abstract Classes
- Demo of Inheritance in OOP