Select the correct option to test your answer:
Computer
Classes And Objects In C Plus Plus
Difficulty: Medium
What will be the output of the following C++ code? #include <iostream> using namespace std; class sample; class sample1 { int width, height; public: int area () { return (width * height);} void convert (sample a); }; class sample { private: int side; public: void set_side (int a) { side = a; } friend class sample1; }; void sample1::convert (sample a) { width = a.side; height = a.side; } int main () { sample sqr; sample1 rect; sqr.set_side(6); rect.convert(sqr); cout << rect.area(); return 0; }
More Computer Questions
In a weighted graph, which algorithm is suitable for finding the shortest path from a single source to a specific target node?
What is the purpose of the 'distance' array in Dijkstra's algorithm?
Literal can be of which of these data types?
Which of the following uses scripted HTTP?
A(n)_____________program is one that is ready to run and does not need to be altered in any way.