CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science Constructors And Destructors Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE CONSTRUCTORS AND DESTRUCTORS DELHI 2006: 2.b) Answer the following questions (i) and (ii) after going through the following class.
(i) create an object, such that it invokes Constructor . 1 Ans: Interview A(10); //invoking constructor 1 by passing a number. (ii) write complete definition for Constructer . 2 Ans: Interview(Interview &t) //This is a copy constructor.
OUTSIDE DELHI 2006: 1.f) What is a default constructor? How does it differ from destructor? 2 a) Default constructor: A constructor that accepts no parameter is called the default constructor.
With a default constructor, objects are created just the same way as variables of other data types are created.
Eg: X ob1; If a class has no explicit constructor defined, the compiler will supply a default constructor. This implicitly declared default constructor is an inline public members of its class. Declaring a constructor with arguments hides the default constructor.There can be a default constructor as well as another constructor with arguments for a class, having multiple constructors is called as constructor overloading. 2.b) Answer the following questions (i) and (ii)after going through the following class.
(i) Create an object, such that it invokes Constructor . 1 Ans: Exam E((2008); (ii) Write complete definition for constructor . 2 Ans: Exam(Exam &t)
//Copy Constructor.
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( mrkdata@yahoo.com ) |