#include <iostream> using namespace std; class Point { int x, y; public: Point(int i = 0, int j = 0) { x = i;… Read More
Tag Archives: C++-Constructors
What is the output of following program? #include <iostream> using namespace std; class Point { int x, y; public: Point(const Point &p) { x… Read More
#include<iostream> using namespace std; class X { public: int x; }; int main() { X a = {10}; X b = a; cout… Read More
Output of following program? #include<iostream> using namespace std; class Point { public: Point() { cout << "Normal Constructor called\n"; } Point(const Point &t) {… Read More
#include<iostream> using namespace std; class Point { public: Point() { cout << "Constructor called"; } }; int main() { Point t1, *t2; return 0;… Read More
Output of following program? <br> #include < iostream ><br> using namespace std;<br> class Point {<br> Point() { cout << "Constructor called"; }<br> };<br><br> int… Read More
When a copy constructor may be called? (A) When an object of the class is returned by value. (B) When an object of the class… Read More