Predict the output?
(A) Compiler Error
(C) Garbage Value
Explanation: There is compiler error: Test::Test() is private.
new makes call to the constructor. In class Test, constructor is private (note that default access is private in C++).
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- C++ | new and delete | Question 4
- C++ | new and delete | Question 2
- C++ | new and delete | Question 1
- C++ | new and delete | Question 5
- "delete this" in C++
- delete and free() in C++
- new vs malloc() and free() vs delete in C++
- C program to delete a file
- C | String | Question 9
- C | String | Question 6
- C | String | Question 5
- C | String | Question 4
- C | Operators | Question 10
- C | Functions | Question 3
- C | Functions | Question 2