|
IGNOU > IGNOU Assignments > BCA > BCA 2007 Assignments > C++ and Object Oriented Programming IGNOU BCA Assignments Question 2: (a). Describe the terms given below giving one example of each:
Ans: (a). Friend Function The member method of any class is only accessible by object of that class i.e. a non member object can’t access member method of class but if we want to communicate or access with member method of two or more classes then we create a common function which is friendly to all the classes. This type of function is created with the keyword “Friend” as prefix with function signature and prototype that function in two or more classes. That means, this function is able to access data element of two or more classes which are friendly to it. The friend function is also known as “Bridge” function. e.g. Class demo1 average (ob1, ob2); * Class demo2 (c). Multiple Inheritance Inheritance is the fundamental OOP feature in which inherit the predefined properties creating new derived class. Having some additional attribute. The class which is inherited is known as base class and who inherits is known as derived class. When a class inherit the properties of more than one class then it is called Multiple Inheritance i.e. a sub class or derived having more than one super or base class. e.g. class A: public B, public C. (d). Copy constructor: When a constructor is use to initialize the data element of one object by data element of other object then that type of constructor is known as copy constructor. e.g. class ABC |
|||||||||||||||||||