Rules of this WIKI section
- Feel Free to edit this page and all related pages
- Keep the page organized following the current layout
- Only Content entirely related to the Object Oriented can be inserted here
- Always add the reference link for your text
- Any copyrights violation will not be allowed
Object Orientation Overview
Object-oriented programming (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs. Programming techniques may include features such as encapsulation, modularity, polymorphism, and inheritance. It was not commonly used in mainstream software application development until the early 1990s. Many modern programming languages now support OOP.
Object Orientation Main Features
Defines the abstract characteristics of a thing (object), including the thing's characteristics (its attributes, fields or properties) and the thing's behaviors (the things it can do, or methods, operations or features).
A pattern (exemplar) of a class.
One can have an instance of a class or a particular object. The instance is the actual object created at runtime.
'Subclasses' are more specialized versions of a class, which inherit attributes and behaviors from their parent classes, and can introduce their own.
Encapsulation conceals the functional details of a class from objects that send messages to it.
Abstraction is simplifying complex reality by modelling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.
Polymorphism allows the programmer to treat derived class members just like their parent class' members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations.
Overriding allows to change the functionality of the inherited methods. This is also known as the redefinition. Follow this blog - ABAP Objects: Overriding(Redefinition) for more information (Note: outside SDN link).
Overriding is not possible for STATIC methods. Read more on Redefine Static Methods? for possible reasoning and solution.
Overloading allows to change the signature of the inherited methods in the subclasses. ABAP doesn't support Overloading. Only exception is the CONSTRUCTOR method. Since we can create CONSTRUCTOR method in each subclass, we can change the signature of this method.
Become a JAVAPER – is overloading possible in ABAP? shows a possibility to achieve Overloading alongwith similarities with Java.
In any Object Oriented programming language, the access to private or protected components – both methods and attributes – would be prohibited. If someone try to access them, compiler would generate syntax error.
Sometimes, it would be advantageous to give the access to these protected and private attributes to other classes. This can be achieved using the FRIENDS addition.
Object Orientation Advanced Features
- Narrowing Cast (Upcasting)
When we assign the instance of the Subclass back to the instance of the Superclass, than it is called the "Narrow Casting", because we are switching from a "More Specific view of an object" to "less specific view". Visit this blog - ABAP Objects: Narrowing Cast (Upcasting) for more information (Note: outside SDN link)
- Widening Cast (Downcasting)
When we assign the instance of the Superclass to the Subclass, than it is called the Widening Cast, because we are moving to the "More Specific View" from the "Less specific view". Due to this reason it is also called the "Down Casting". Visit this blog - ABAP Objects: Widening Cast (Downcasting) for more information (Note: outside SDN link).
Free Rice meals
- Provide English vocabulary to everyone for free.
- Help end world hunger by providing rice to hungry people for free.
For each word you get right, Free Rice donate 20 grains of rice through the UN World Food Program to help end hunger