11
Loading subject content…
Loading subject content…
Loading practice questions…
What will be the output of the program?
#include <iostream>
using namespace std;
class S {
public:
static int twice(int v) { return 2 * v; }
};
int main() {
cout << S::twice(8) << endl;
return 0;
}What will be the output of the program?
#include <iostream>
using namespace std;
class Rect {
int w, h;
public:
Rect(int a, int b) : w(a), h(b) {}
int area() const { return w * h; }
};
int main() {
Rect r(6, 7);
cout << r.area() << endl;
return 0;
}What will be the output of the program?
#include <iostream>
using namespace std;
class A { int a; char c; };
class E {};
int main() {
cout << (sizeof(E) >= 1) << endl;
return 0;
}