Who created C++?
How many ways are there to initialize an integer variable with a constant value?
When double is converted to float, then the value is?
Is the following statement a declaration or a definition?
int (*x)[10];
Which of the following operator has left to right associativity?
Which type of relationship is modeled by Aggregation?
What type of array is generated from command line arguments?
Which of the following statements about pure virtual functions is true?
What is the output of this C code?
int main()
{
while ()
printf("In while loop ");
printf("After loop\n");
}
#include <iostream>
using namespace std;
class CVector {
public:
int x,y;
CVector () {};
CVector (int a,int b) : x(a), y(b) {}
CVector operator + (const CVector&);
};
CVector CVector::operator+ (const CVector& param) {
CVector temp;
temp.x = x + param.x;
temp.y = y + param.y;
return temp;
}
int main () {
CVector foo (3,1);
CVector bar (1,2);
CVector result;
result = foo + bar;
cout << result.x << ',' << result.y << '\n';
return 0;
}