You are on page 1of 2

Object Oriented Analysis and Design, Fall 2019 [Class Activity # 1]

Time Allowed: 15 minutes Total Marks: 10

Name: _________________________________ Registration Number: _______________________________

Question 1:

Write output of the following code snippet. (Assuming that there is no syntax error)

Code: Output:
#include <iostream>
using namespace std;
class Probe
{
public:
Probe()
{
cout << "Hello Default C-tor" <<
endl;
}
Probe(char* _n, double _marks)
{
cout << "Hello Para C-tor" << endl;
}
Probe(const Probe & ref)
{
cout << "Hello Copy C-tor" << endl;
}
};
// A Global Function
Probe F1(Probe pRef1, Probe & pRef2)
{
Probe localProbe = pRef2;
cout << "Hello F1" << endl;
return Probe();
}
int main()
{
Probe q1("Q1", 1.5);
Probe q2 = q1;
Probe q3;
q3 = q1;
Probe q4(q2);
Probe q5 = F1(q3,q4);
return 0;
}

You might also like