Skip to content

Tag Archives: Destructors

In Object Oriented Programming, Objects are the instances of a class which has its own state(variables) and behavior(methods).  Every class has two special methods related… Read More
Can destructors be virtual in C++? (A) Yes (B) No Answer: (A) Explanation: See https://www.geeksforgeeks.org/g-fact-37/Quiz of this Question My Personal Notes arrow_drop_up Save
#include <iostream> using namespace std;  class A {     int id;     static int count; public:     A() {         count++;         id = count;         cout << "constructor for id… Read More
Like constructors, can there be more than one destructors in a class? (A) Yes (B) No Answer: (B) Explanation: There can be only one destructor… Read More
Predict the output of following C++ program #include <iostream> using namespace std;     int i;     class A { public:     ~A()     {         i=10;     } };… Read More
Can destructors be private in C++? (A) Yes (B) No Answer: (A) Explanation: Destructors can be private. See Private Destructor for examples and uses of… Read More

Start Your Coding Journey Now!