0% found this document useful (0 votes)
18 views2 pages

OOPs ABAP

Uploaded by

Subbu Kyla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

OOPs ABAP

Uploaded by

Subbu Kyla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1. What is a static class?

A static class is usually one in which all methods and attributes are declared static. (The use of static
classes is comparatively low with instance classes.).

2. Is it possible to create objects for static classes?


Yes, we can create instances for the static class as well as call all objects without creating instances of the
object.

3. What are the patterns in OOP ABAP?


• Single-ton.
This pattern is built using a private class, which does not allow you to create an instance of the
object outside the class. Also, multiple instance creation is not possible here.
• Factory.
This pattern also builds using a private class, which does not allow you to create an instance of the
object outside the class. But here, multiple instance creation is possible.
• Composite.
This pattern is quite different from others. It has a base class, which is abstract, which is a
protected class, and we will have a few subclasses based on the requirements. So, we will be
creating the objects for the subclasses inside the base class using input variables. We will redefine
those methods in the base class and use them accordingly in the subclasses.

4. What does the ‘Final’ keyword mention?


If the final keyword is used for a class, then that class cannot be inherited further, and when a method is set
to final, it should be called at the last method of that class.

5. What is an inheritance?
Inheritance is a concept by which a subclass or child class is derived by inheriting the superclass or parent
class. Which will give access to all public, protected methods and attributes of superclass to subclass. By
doing so, we can redefine a method or incorporate a few methods of superclass into subclass.

6. Is multiple inheritance possible in ABAP?


No, Multiple inheritance is not possible in ABAP. But that is achieved by implementing two or more
interface in a class.

7. What is an interface in ABAP?


An interface is nothing but a declaration of methods that are not implemented in it and cannot be
instantiated separately. We can only inherit the interface from a class, and then we can implement the logic
in the class for the methods present in the interface.

8. What is Abstract class?


Abstract class is one of the special types of classes in ABAP. Which cannot be instantiated without
inheriting from a class. An abstract class can contain one or more abstract methods. When an abstract
class is inherited in a class, all abstract methods must be implemented.
9. How to use the private method of class A in class B?
If the class A is declared as a global friends of class B, then All methods and attributes including private of
class A can be accessed by class B.

10. Difference between a static and constant variable.


Constant is a variable which remains constant and cannot be changed by the code. But Static variables
can be changed but it will be similar for all instances of the class.

11. Difference between instance and static variable.


If a class has both instance and static variable, the class has been instantiated for two times.
The two instance variables of the two objects can hold different values but static has similar value across
all instances of the class.

12. What are the types of classes in ABAP?


• Usual ABAP class
• Exception class
• Persistent class
• Test class

13. What is encapsulation?


Encapsulation is a concept of OOPS in which the object is hide or not manipulated outside the class.
So, it will have control over the objects.

14. What is Polymorphism?


Polymorphism refers to the process of redefining methods to overload or override them. When we use the
same method name but different parameters, we are using overloading methods. When we override a
method, we use the same method name and parameters, but an inheritance association link the two
methods.
Method overloading is technically not possible in ABAP.

15. Exception class in ABAP and how to implement it?


Exception class are the classes which are used to catch exceptions in a class. This can be achieved by
either try catch method or raise exception keyword. In ABAP we have a super class called CX_ROOT, this
class is the superclass for all exception classes.

You might also like