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 http://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++ progran #include <iostream> using namespace std;     int i;     class A { public:     ~A()     {         i=10;     } };… Read More
Can destuctors 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