Correct Answer:
Control Source
Note: This Question is unanswered, help us to find answer for this one
#include<iostream>
using namespace std;
class Point {
private:
int x, y;
publi
Point() : x(0), y(0) { }
Point& operator()(int dx, int dy);
void show() {cout << "x = " << x << ", y = " << y; }
};
Point& Point::operator()(int dx, int dy)
{
x = dx;
y = dy;
return *this;
}
int main()
{
Point pt;
pt(3, 2);
pt.show();
return 0;
}
Correct Answer:
x = 3, y = 2
Note: This Question is unanswered, help us to find answer for this one
Predict the output?
#include<stdlib.h>
#include<stdio.h>
#include<iostream>
using namespace std;
class Test {
int x;
publi
void* operator new(size_t size);
void operator delete(void*);
Test(int i) {
x = i;
cout << "Constructor called \n";
}
~Test() { cout << "Destructor called \n"; }
};
void* Test::operator new(size_t size)
{
void *storage = malloc(size);
cout << "new called \n";
return storage;
}
void Test::operator delete(void *p )
{
cout<<"delete called \n";
free(p);
}
int main()
{
Test *m = new Test(5);
delete m;
return 0;
}
Correct Answer:
new called
Constructor called
Destructor called
delete called
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Conversion Operator
Note: This Question is unanswered, help us to find answer for this one
Which of the following operators are overloaded by default by the compiler?
1) Comparison Operator ( == )
2) Assignment Operator ( = )
Correct Answer:
Only 2
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
A postfix ++ has a dummy parameter
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
By making an empty private new and new[] operators
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
A object is declared
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
A group function with the same name
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Insertion Operator <<
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Virtual tables
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Private
Note: This Question is unanswered, help us to find answer for this one
Output of following program?
#include <iostream>
using namespace std;
class Test2
{
int y;
};
class Test
{
int x;
Test2 t2;
publi
operator Test2 () { return t2; }
operator int () { return x; }
};
void fun ( int x) { cout << "fun(int) called"; }
void fun ( Test2 t ) { cout << "fun(Test 2) called"; }
int main()
{
Test t;
fun(t);
return 0;
}
Correct Answer:
Compiler Error: Ambiguous call to fun()
Note: This Question is unanswered, help us to find answer for this one