1. What is a Class ?
Class represents the real time object. Class have different components like attributes,methods which the behaviour of an Object. In ABAP we create two types of Local Class and Global Class(SE24).
2. Where do you create Global class in ABAP ?
Transaction Code : Class Builder – Se24
3. How do you create a Local class in ABAP with syntax ?
Local class is created in ABAP programs(Se38) which are local to these programs only. There are two parts in Local Class creation 1.DEFINITION and 2.IMPLEMENTATION.
CLASS class DEFINITION.
CLASS class IMPLEMENTATION.
4. What are different components available in Class ?
Attributes, Methods, Events, Types and Constants are different components which are available in Class.
5. What is an Object ?
Object is an instance of a Class.A class can have any number of objects. Objects in Business environment are Order, Customer etc..
6. What is the syntax to create Object in ABAP ?
CREATE OBJECT <object_name>. For example CREATE OBJECT lo_order.
7. What are principles of Object Oriented Programming(OOP) ?
There are 4 major principles in OO Programming. They are of Abstraction, Encapsulation, Inheritance and Polymorphism.
8. What is Encapsulation in Object Oriented Programming(OOP) ?
Encapsulation is the main concept in OOP. Encapsulation means hiding attributes and methods from outside world, so by this way we can restrict the visibility of object( an instance of a class) components(attributes and methods).
9. How do you achieve encapsulation in OO ABAP?
We can achieve encapsulation in OO ABAP by using PUBLIC, PRIVATE and PROTECTED keywords in OO ABAP.These are also called as access specifiers.
9. What are access specifiers in OO ABAP ?
PUBLIC, PRIVATE and PROTECTED are three access specifiers available in OO ABAP.
10. What is polymorphism in OO ABAP ?
Redefining methods of superclass in sub class is called polymorphism.
11. How can you achieve polymorphism in OOP ?
Polymorphism is achieved by Inheritance in OOP ABAP.
12. What is Inheritance in OO ABAP ?
Deriving a new class from an existing class in called as Inheritance.Existing class is called as Super class and derived new class is called as Sub class.Derived class get all attributes and methods from the super class and in addition to that we create new attributes and methods.
13. What is the ABAP syntax for Inheritance in OO ABAP ?
CLASS <subclass_name> DEFINITION INHERITING FROM <superclass_name>.
14. What are different types of class you can create in Class Builder in OO ABAP ?
Normal ABAP Class, Exception Class, Persistence Class and Test Class