Ans: No it is not mandatory to implement all normal interface methods but it is mandatory to implement all Abstract methods.
Ans: Interface is class which contains methods without implementations.
Ans: No, we can not instantiate interface using create object keyword.
Ans: Yes, by using interface concept in SAP ABAp, we can achieve multiple inheritance
Ans: Yes, by using interface concept in SAP ABAP, we can polymorphism
Ans: Abstract class is a class which contains at least one abstract method( Method without implementation), Abstract class contains methods with implementation and without implementation and we cannot create instance for the abstract class .
Ans: Alias is an alias name for the interface method implemented in the class .
Ans: No, you can not raise events in interface, Because there is no Implementation for the methods. We can create events in interfaces .
Ans: Single-ton class is a class which allows to instantiate once only .
Ans: Public attributes can be accessed by class, subclasses and other classes where as Private attributes can be accessed by class itself only.
Ans: A Class is actually a blueprint or a template to create an Object. Whereas an Object is a an actual instance of a Class. For example Employee ia a class, while John is a real employee which is an Object of Employee Class.
Ans: Some examples to implement polymorphism:
Ans: In OOPs terminology, inheritance is a way to form new classes using classes that have already been defined. Inheritance is intended to help reuse existing code with little or no modification. The new classes, known as derived classes, inherit attributes and behavior of the pre-existing classes, which are referred to as base classes.
Ans:
Ans: Method overloading is in a class have many methods having same name but different parameter called overloading or static polymorphism
Ans: Aggregation is a special form of association. Aggregation is the composition of an object out of a set of parts. For example, a car is an aggregation of engine, tyres, brakes, etc.
Aggregation represents a "Has" relationship like a car has a engine.
Ans: Object oriented programming language allows concepts such as abstraction, modularity, encapsulation, polymorphism and inheritance. Simula is the first object oriented language. Objects are said to be the most important part of object oriented language. Concept revolves around making simulation programs around an object.
Ans:
Ans: In object-oriented programming, polymorphism (from the Greek meaning "having multiple forms") is the characteristic of being able to assign a different meaning to a particular symbol or "operator" in different contexts. The simple example is two classes that inherit from a common parent and implement the same virtual method.
Ans:
Ans: Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. In the same way that abstraction sometimes works in art, the object that remains is a representation of the original, with unwanted detail omitted. The resulting object itself can be referred to as an abstraction, meaning a named entity made up of selected attributes and behavior specific to a particular usage of the originating entity.
Ans:
Ans: In general there are two types of Objects: Instance Object and Static Object and as such there are two types of Classes: Instance class and Static Class. Specifically when it comes to visibility, Private class, Protected class and Public classes are the types of classes one can have.
Ans:
Ans:
Ans: Objects can only be created and addressed using reference variables. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
Ans: Objects can only be created and addressed using reference variables. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
Ans:
Ans: A super class is a generalization of its subclasses. The subclass in turn is a specialization of its super classes.
Ans: The assignment of a subclass instance to a reference variable of the type "reference to superclass" is described as a narrowing cast, because you are switching from a more detailed view to a one with less detail.
Ans: 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.
Ans: If it is to be impossible to instantiate a class more than once (for example, because it serves as a data administrator or data container), you can use the singleton concept. The class is defined with the addition CREATE PRIVATE and FINAL and instantiated using its static constructor. A public static component could then make the reference to the class available to an external user.
Ans: Inherited methods can be redefined in subclasses Redefined methods must be re-implemented in subclasses. The signature of redefined methods cannot be changed Static methods cannot be redefined. In inheritance, static components are "shared": A class shares its non-private static attributes with all its subclasses. In ABAP Objects, you can not only add new components, but also provide inherited methods with new implementations. This is known as redefinition. You can only redefine (public and protected) instance methods, other components (static methods, attributes and so on) cannot be redefined. Changes to method parameters (signature changes) are not possible.
Ans: In inheritance, static components are "shared": A class shares its non-private static attributes with all its subclasses. => and -> are the component selectors used to refer.
Ans: A component instance is a running component that can be run in parallel with other instances of the same component.
Ans: Encapsulation means that the implementation of an object is hidden from other components in the system, so that they cannot make assumptions about the internal status of the object and therefore dependencies on specific implementations do not arise.
Ans: BADI - Business Add Ins are enhancements to the standard version of the code of SAP.
Filter Badi- Business Add-Ins may be implemented on the basis of a filter value. If an enhancement for country-specific versions is provided for in the standard version, it is likely that different partners will want to implement this enhancement. The individual countries can create and activate their own implementation.
Ans:
Ans: Protected components Only visible within the class and its sub classes.
Ans:
Ans: Methods that have a RETURNING parameter are described as functional methods. These methods cannot have EXPORTING or CHANGING parameters, but has many (or as few) IMPORTING parameters and exceptions as required.
Ans: To go to an address before performing the operation a dereference variable is a pointer to the variable, not the variable itself. A pointer can be re-assigned any number of times while a reference cannot be reassigned after initialization. Field symbols are similar to dereference pointers. Thus, you can only access the content of the data object to which the field symbol points. (That is, field symbols use value semantics). If you want to access the content of the data object, you need to dereference the data reference first.
Ans: Yes, class can be created without any constructor. Default constructor will be created when we define a class without constructor.
Ans: Instance method is available separately in each object (instance), static method is global and no instance is required for static method.
once .
Ans: Class is user defined data type which contains methods, events, attributes, interfaces etc.
Ans: Before going to static classes, you should understand static components.
Ans: No we can not make interface methods as abstract or final in Object Oriented ABAP
Ans: Yes, we can declare events in interface in Object Oriented ABAP
Ans: Singleton class is a class which allows to instantiate(Create Object) only
Ans: Global classes and interfaces are defined in the Class Builder (Transaction SE24) in the ABAP Workbench.All of the ABAP programs in an R/3 System can access the global classes
Ans: Local classes are defined in an ABAP program (Transaction SE38) and can only be used in the program in which they are defined.
Ans: Event is a mechanism by which method of one class can raise method of another class, without the hazard of instantiating that class.
Ans: We need to follow below steps when working with events in Object Oriented ABAP:
Ans:
Ans: Abstract methods is a method which doesn't contain any implementation.
Ans:
Ans:
Ans: It is the keyword which indicates the class definition is delayed or postponed or Defined at some place in program.
Syntax : CLASSÂ Â DEFINITION DEFERED.
Ans: Some of the main advantages of Object Oriented ALV
Ans: CONSTRUCTOR's are special type of methods, constructor method is executed automatically whenever a object is created or instantiated.
Ans: Polymorphism is a concept by which the same method names will behave differently in different classes i.e each method will have it's own implementation in different classes but with the same name.
Ans: Yes, class can be created without any constructor. Default constructor will be created when we define a class without constructor.
Ans: Friend class is a class it can access private components of it’s friends class.
Ans: Instead of specifying full name of interface methods, we can assign it a name which can directly trigger.
Ans: It just like a selfreference, by this we can call methods that are with in same class with out creating object.
Ans:
Data: ref type ref to .
Create object ref.
Ans: Call method ref>method_name .
Ans:
Ans: We can create many instances of the same class with in a program, but we cannot create many instances of function group.
Ans:
Ans:
class <cl_name> definition.
Public section.
Methods: m1 importing p1 type
Exporting p2 type
Changing p3 type
Returning p4 type
Exceptions
Protected section
Private section
Endclass
Class <c1_name> implementation.
Method m1.
Endmethod.
Endclass
Ans: In general we can not create object for a private class, but we can access static method of a private class so call that method using its class name and import that object.
For example take one static method with an exporting parameter inside private class and write object creation code in that static method and export that object.