Constructor and destructor functions


Question 1: Describe the use of a constructor function in a class? Give an appropriate illustration of a constructor function in a class.

Question 2: Design a class containing the constructor and destructor functions which should display the number of object being made or destroyed of this class type.

Question 3: Write a C++ program, to determine the factorial of a number by using a constructor and a destructor (generating the message “you have done it”).

Question 4: Define a class ‘string’ with members to initialize and find out the length of the string. Overload the operators ‘+’ and ‘+=’ for the class ‘string’.

Question 5: Explain the concept of inheritance with the help of an illustration.

Question 6: What do you mean by virtual base class? When do we make it?

Question 7: Write a program in c++ which explains the use of inheritance.

Question 8: What do you mean by the function returning a pointer? Give any appropriate illustration to support your answer.

Question 9: Distinguish between the compile time polymorphism and run time polymorphism.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Constructor and destructor functions
Reference No:- TGS07804

Expected delivery within 24 Hours