What do you mean by constructor and destructor? Explain the necessity of copy constructor with example. Also explain order of invocation of constructor and destructor with example.
Objects and Classes
CT 501 · Chapter 4
Your campus trial expires in
Click to unlock Premium— out of — readSign in to save progress
- Chapters
- 10
- Questions
- 32
Past questions by syllabus
Objects and Classes
Constructors
14 questions- 2082 ShrawanChapter 4: Objects and Classes4.5 Constructors
- 2082 BaishakhChapter 4: Objects and Classes4.5 Constructors
Why do we need constructors and destructor? Create a class called "time" with data member hour, minute, second and day. Initialize all the data member using constructor. Write a program to add two "time" object using necessary member functions and display the result in main().
- 2081 BaishakhChapter 4: Objects and Classes4.5 Constructors
What are the properties of Constructors? Create a class called volume that uses three data members (length, width, height) in terms of feet and inches to model the volume of a room. Read the three dimensions of the room and calculate the volume it represent, and print out the result. The volume should be in feet, i.e. you will have to convert each dimension into the feet and fraction of foot. For instance, the length 12 feet and 6 inches will be 12.5 ft.
- 2081 BhadraChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2080 BaishakhChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2080 BhadraChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2078 BhadraChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2078 KartikChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2076 ChaitraChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2075 AshwinChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2073 ShrawanChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2072 ChaitraChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2070 ChaitraChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
- 2070 ChaitraChapter 4: Objects and Classes4.5 ConstructorsClick to unlock premiumSee the full question with a premium plan
Objects as Function Arguments and Return Types
5 questions- 2082 ShrawanChapter 4: Objects and Classes4.7 Objects as Function Arguments and Return TypesClick to unlock premiumSee the full question with a premium plan
- 2075 AshwinChapter 4: Objects and Classes4.7 Objects as Function Arguments and Return TypesClick to unlock premiumSee the full question with a premium plan
- 2073 ShrawanChapter 4: Objects and Classes4.7 Objects as Function Arguments and Return TypesClick to unlock premiumSee the full question with a premium plan
- 2069 ChaitraChapter 4: Objects and Classes4.7 Objects as Function Arguments and Return TypesClick to unlock premiumSee the full question with a premium plan
- 2068 ChaitraChapter 4: Objects and Classes4.7 Objects as Function Arguments and Return TypesClick to unlock premiumSee the full question with a premium plan
Dynamic Memory Allocation for Objects and Object Arrays
1 question- 2072 KartikChapter 4: Objects and Classes4.10 Dynamic Memory Allocation for Objects and Object ArraysClick to unlock premiumSee the full question with a premium plan
Pointers
1 question- 2079 BhadraChapter 4: Objects and Classes4.11 PointersClick to unlock premiumSee the full question with a premium plan
Static Data Members and Static Functions
1 question- 2068 BaishakhChapter 4: Objects and Classes4.12 Static Data Members and Static FunctionsClick to unlock premiumSee the full question with a premium plan
Constant Member Functions and Constant Objects
3 questions- 2083 Baishakh2080 BaishakhChapter 4: Objects and Classes4.13 Constant Member Functions and Constant ObjectsClick to unlock premiumSee the full question with a premium plan
- 2076 AshwinChapter 4: Objects and Classes4.13 Constant Member Functions and Constant ObjectsClick to unlock premiumSee the full question with a premium plan
- 2074 AshwinChapter 4: Objects and Classes4.13 Constant Member Functions and Constant ObjectsClick to unlock premiumSee the full question with a premium plan
Friend Functions and Friend Classes
7 questions- 2083 BaishakhChapter 4: Objects and Classes4.14 Friend Functions and Friend ClassesClick to unlock premiumSee the full question with a premium plan
- 2081 BaishakhChapter 4: Objects and Classes4.14 Friend Functions and Friend ClassesClick to unlock premiumSee the full question with a premium plan
- 2079 BhadraChapter 4: Objects and Classes4.14 Friend Functions and Friend ClassesClick to unlock premiumSee the full question with a premium plan
- 2074 ChaitraChapter 4: Objects and Classes4.14 Friend Functions and Friend ClassesClick to unlock premiumSee the full question with a premium plan
- 2070 AshadhChapter 4: Objects and Classes4.14 Friend Functions and Friend ClassesClick to unlock premiumSee the full question with a premium plan
- 2069 ChaitraChapter 4: Objects and Classes4.14 Friend Functions and Friend ClassesClick to unlock premiumSee the full question with a premium plan
- 2068 ChaitraChapter 4: Objects and Classes4.14 Friend Functions and Friend ClassesClick to unlock premiumSee the full question with a premium plan