Would destructor be called, if yes, then due to which vector?
#include <iostream> #include <vector> using namespace std; class a { public : ~a() { cout << "destroy"; } }; int main() { vector <a*> *v1 = new vector<a*>; vector <a> *v2 = new vector<a>; return 0; } |
chevron_right
filter_none
(A) v1
(B) v2
(C) v1 and v2
(D) no destructor call
Answer: (D)
Explanation:
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C++ | Misc C++ | Question 8
- C | Misc | Question 7
- C++ | Misc C++ | Question 1
- C++ | Misc C++ | Question 7
- C++ | Misc C++ | Question 7
- C++ | Misc C++ | Question 3
- C | Misc | Question 2
- C | Misc | Question 1
- C | Misc | Question 6
- C | Misc | Question 8
- C++ | Misc C++ | Question 5
- C | Misc | Question 9
- C++ | Misc C++ | Question 2
- C | Misc | Question 7
- C | Misc | Question 5
- C | Misc | Question 6
- C++ | Constructors | Question 14
- C | Operators | Question 2
- C Quiz - 101 | Question 1
- C Quiz - 101 | Question 2

