What Is The Difference Between Procedural and Object Oriented Programming ?
What Is The Difference Between Procedural and Object Oriented Programming ?
• In procedure oriented language data has not security but in object oriented data has
security.
• Procedure oriented programming gives importance to algorithm rather than data. It
follows Top-down structures.
• Object Oreinted Programming gives importance to data rather than algorithm. It follows
Bottom – Up structures.
• There is no access specifier in Procedural Programming and in OOP there are public,
private and protected specifier.
• OOPs includes features like data hiding polymorphism encapsulation and message
passing.
• Encapsulation
• Polymorphism
• Inheritance
• A class is a construct that is used as a blueprint (or template) to create Object of that
class.
• The state and behavior that the objects of the class all share.
• The class that contains that instance can be considered as the type of that object, e.g. an
object instance of the "Fruit" class would be of the type "Fruit".
5. What are the type of Classes that can be created ?
• ABAP class
• Persistence Class
• Exception Class
• You define global classes and interfaces in the Class Builder (Transaction SE24) in the
ABAP Workbench.
• Local classes and interfaces can only be used in the program in which they are defined.
• When you use a class in an ABAP program, the system first searches for a local class
with the specified name.
• There are two kinds of data reference variables - data reference variables and object
reference variables.
• Abstract classes are classes that contain one or more abstract methods.
10. What is the difference Between Abstract Method and Final Method?
• A final method cannot be redefined in a subclass. Final classes cannot have subclasses.
• Inheritance is a relationship, in which one class (the subclass) inherits all the main
characteristics of another class (the superclass).
• The subclass can also add new components (attributes, methods, and so on) and replace
inherited methods with its own implementations.
• A super class is a generalization of its subclasses. The subclass in turn is a
specialization of its super classes.
• The widening cast is, as with inheritance, the opposite of the narrowing cast: Here it is
used to retrieve a class reference from an interface reference. Obviously it cannot be
statically checked, since an interface can be implemented by more than one class.
• Singleton will not able to create to an instance for already declared class.
• To implement a redefined method in a subclass, you often need to call the method of the
same name in the immediate super class.
• The contents of static Component define the state of the class that is valid for all instances
of the class. Static component exist once for each class.
• They are accessible for the entire runtime of the class.
• The contents of Instance Component define the instance state of the class that is valid for that
particular instance of the class.
• Instance component will be vary along the entire class.
• Interfaces will be act as a tool to inherit the behaviour of various classes in a single calss.
• Modify the Interface will modify the functionality wherever it has been used.
• Multi Inheritance can be possible using this Interfaces.
• Event can be raised,when an object or class announces a change of state, or that a certain
state has been achieved.
• A class or instance can trigger an event at runtime using the RAISE EVENT statement.
• When there is no point in continuing to run the program in the normal way
then the Exceptions will occur.
• Exceptions are raised either using the ABAP statement RAISE EXCEPTION or
by the ABAP runtime environment.
• Protected method can be accessed only by its class and its sub-classes.
IF Ref_Var IS BOUND.
ENDIF.
Ref_Var is a reference variable. The above condition describes whether that reference
variable is referring to valid reference or not.
• Alias names can only appear in the in the declaration part of a class or in the interface
definition.
• An alias defined in this way can be directly addressed using r_ref->a1.
When defining:
• Only one RETURNING parameter
• Only IMPORTING parameters and exceptions are possible
• The Garbage Collector is a system routine that automatically deletes objects that can no
longer be addressed from the main memory and releases the memory space they
occupied.
• The static constructor is a special static method in a class with the name Constructor name. It
is executed precisely once per program. The static constructor of a class is called
automatically when the class is first accessed, but before any of the following actions are
executed:
• Creating an instance in the class using CREATE OBJECT <obj>, where <obj> has the
data : type REF TO <classname>
• Addressing a static attribute using <classname>=><attribute>
• Calling a static attribute using CALL METHOD <classname>=><classmethod>
• Registering a static event handler method using SET HANDLER
• <classname>=><handler_method> FOR <obj>
• Registering an event handler method for a static event in class <classname>.
• The static constructor cannot be called explicitly.
31. What is a private Constructor? Limitations?
• When you declare a Constructor with Private access modifier then it is called Private
Constructor.
• We can use the private constructor in singleton pattern.
• If you declare a Constructor as private then it doesn’t allow to create object for its derived
class
• A class can provide friendship to other classes and interfaces (and hence all classes
that implement the interface). To do this you use the FRIENDS additions to the
CLASS statement, in which all classes and interfaces that are to be provided
friendship are listed.
• Friends are allowed to access the protected and private components of the class
providing the friendship and can always create instances of this class, regardless of the
CREATE addition to the CLASS statement.