Home
About Us
Contact Us
Bookmark
Saved Bookmarks
Current Affairs
General Knowledge
Chemical Engineering
UPSEE
BSNL
ISRO
BITSAT
Amazon
ORACLE
Verbal Ability
→
C++
→
Objects & Iterators In C++ in C++
→
Can destructors be private in C++?(A) Yes(B) No
1.
Can destructors be private in C++?(A) Yes(B) No
Answer»
Show Answer
Discussion
No Comment Found
Post Comment
Related InterviewSolutions
Can destructors be virtual in C++?(A) Yes(B) No
Predict the output of following C++ program#include <iostream>using namespace std;int i;class A{public:~A(){i=10;}};int foo(){i=3;A ob;return i;}int main(){cout << foo() << endl;return 0;}(A) 0(B) 3(C) 10(D) None of the above
#include <iostream>using namespace std;class A{int id;static int count;public:A() {count++;id = count;cout << "constructor for id " << id << endl;}~A() {cout << "destructor for id " << id << endl;}};int A::count = 0;int main() {A a[3];return 0;}(A)constructor for id 1constructor for id 2constructor for id 3destructor for id 3destructor for id 2destructor for id 1(B)constructor for id 1constructor for id 2constructor for id 3destructor for id 1destructor for id 2destructor for id 3(C)Compiler Dependent.(D)constructor for id 1destructor for id 1
Like constructors, can there be more than one destructors in a class?(A) Yes(B) No
Can destructors be private in C++?(A) Yes(B) No
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies