You are on page 1of 2

1) Difference between interface and abstract class.

Ans: In an abstract class, atleast one method is not defined where as in an interface no method is defined ie all methods have to be redefined in the class that implements the interface. 2) What is narrowing cast? Ans: If A is an object of a super class and B is an object of the child class, then, the statement A = B is called narrowing cast. By doing this, the super class object A can access the public n protected members that the child class inherited from it and also the redefined methods of the child class.

3) By default, what is the visibility in a class? Ans: Unless specified, the visibility in a class is private.

4) What is CLASS_CONSTRUCTOR? When is it called? Ans: CLASS_CONSTRUCTOR is the static constructor of a class that is used to initialize the static attributes ( CLASS-DATA) of a class. It is called before the class is instantiated.

1. Adv of OOP. a) Programs are faster to write b) Programs are easier to maintain c) Programs are highly unlikely to break when you change them d) Every project generates re-usable objects to make all further projects easier e) Control of complexity and dependencies f) Reuse - of components and by inheritance g) 2.

2.Encapsulation, Inheritance, Polymorphism. 3.Class lcl_vehicle DEFINITION ENDCLASS. CREATE OBJ lcl_vehicle. CLASS lcl_vehicle IMPLEMENTATION. ENDCLASS. 4.Components of class are Attributes, Methods, Events, Constants, Types and IMplemented INterfaces. 5.TYPE REF TO refers to a class object. 6.READ-ONLY addition means that a public attribute declared with DATA can only be read from outside, but can only be changed by the methods of the class. 7.READ-ONLY can be used in PUBLIC or Interface Def. 8.Public and Private

9.Public can be viewed and changed by all the users and in all methods. Direct access. 10.Private can only be viewed and changed within the class.No direct aceess outside the class.You can access an object's private attributes using public methods 11.Instance attributes Vs Static attributes. Ins attribute 1 per instance and defined using DATA statement Stat attribute- 1 per class and defined using CLASS-DATA. Also known as class attributes.

You might also like