Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

C++ | Constructors | Question 4

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article




#include<iostream>
using namespace std;
class Point {
public:
    Point() { cout << "Constructor called"; }
};
  
int main()
{
   Point t1, *t2;
   return 0;
}

(A) Compiler Error
(B) Constructor called
Constructor called

(C) Constructor called


Answer: (C)

Explanation: Only one object t1 is constructed here. t2 is just a pointer variable, not an object

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads