Predict the output of following C++ program. Difficulty Level: Rookie Question 1 1 #include <iostream> 2 using namespace std; 3 4 class A 5 { 6 int id; 7 public: 8 A (int i) 9 { 10 id = i; 11 } 12 void print() 13 { 14 cout << id << endl;…
Predict the output of following C++ programs. Question 1 1 #include<iostream> 2 using namespace std; 3 4 class Base 5 { 6 public: 7 int fun() 8 { 9 cout << "Base::fun() called"; 10 } 11 int fun(int i) 12 { 13 cout << "Base…
Predict the output of following C++ program. 1 #include<iostream> 2 using namespace std; 3 4 class A 5 { 6 // data members of A 7 public: 8 A () 9 { 10 cout << "\n A's constructor"; /* Initialize data members */ 11 } 12 A (const A &a…
Predict the output of following C++ programs. Question 1 1 #include<iostream> 2 using namespace std; 3 4 class Point 5 { 6 private: 7 int x; 8 int y; 9 public: 10 Point(const Point&p) 11 { 12 x = p.x; 13 y = p.y; 14 } 15 void setX(int i) 16 { 17…
Predict the output of following C++ programs. Question 1 1 template <class S, class T> class Pair 2 { 3 private: 4 S x; 5 T y; 6 /* ... */ 7 }; 8 9 template <class S> class Element 10 { 11 private: 12 S x; 13 /* ... */ 14 }; 15 16 int main ()…
Predict the output of below C++ programs. Question 1 1 #include<iostream> 2 3 using namespace std; 4 5 class Test 6 { 7 int value; 8 public: 9 Test (int v = 0) 10 { 11 value = v; 12 } 13 int getValue() 14 { 15 return value; 16 } 17 }; 18 19 int main…