Object-Oriented Programming

What is OOP?

Object-Oriented Programming, or OOP refers to the ways to organize programs around objects. An object is an implementation of an Abstract Data Type. An object contains both data, representing the state of the object at any given point, and the operations that access, change, or manipulate that state. The variables that represent the state information of an object are called the data members of the object. The operations that manipulate this state information are called member functions, or methods. Both of these terms refer to the same concept. The former is commonly used in C++, the latter in SmallTalk and Java, among others.

One can view an object-oriented program as a collections of such objects. Each object is an active agent offering services that it can do for other objects, much like lawyers and physicians offer services to their clients. These services are the methods of the object. When the code of a method is executed, the method changes the data encapsulated in the object or does other useful work.

A client object can cause a service to be executed by sending a message to the object that offers that service. Sending a message to another object is equivalent to calling the corresponding member function, or method of the object. In response, the method's code is executed and the service is performed. In an object-oriented program all work is done this way, by objects sending messages back and forth to each other.

The ideas of OOP first appeared with the similar programming language almost 30 years ago. However it entered the mainstream of programming practice much more recently.

OOP Advantage

Objects can be used to model "real-world" concepts in an application. Applications often represent real-world systems in some way, and therefore organizing applications this way will make the application resemble the structure inherent in the system that it represents. This close correspondence will make the application both easier and more natural to understand, and better understanding will often lead to applications that have fewer bugs, are more reliable and easier to maintain. Object-Oriented programming languages support a number of OOP techniques that further increase the reliability, reusability, and maintainability of code. These include encapsulation, data hiding, inheritance, and polymorphism.

EPL Class

EPL is an OOP supported development environment, EPL Class is the implemented of EPL-OOP.

      The EPL Class contains

Feature Description
Construction Construction Order: 1, Construct base-class; 2, Construct inheriting-class; Construct object member first before construct class itself
Destruction Destruction Order: 1, Destruct inheriting-class; 2, Destruct base-class; Destruct containing class first before destruct class’s object member
Inheritance Any class can specify a class as base class to inherit, inheriting level is unlimited
Virtual Method Virtual method of base class(inherited) can be overwritten by its inheriting class
Polymorphism Inheriting-class can set to its base class, and operate a base class memory just change to operate a same member in inheriting-class
Package Class private member can only access by the class itself. In inheriting class, use “ClassName.MethodName()” to call the method of its base class. The method only can be called by this class external instance if it has mark of “public”

 

Base Class & Inheriting Class Relationship

Base Class is inherited by inheriting Class, it is just the inheriting class inherits from base class.