Select the correct option to test your answer:
Computer
Inheritance In C Plus Plus
Difficulty: Medium
What will be the output of the following C++ code? #include <iostream> using namespace std; class student { public: int rno , m1 , m2 ; void get() { rno = 15, m1 = 10, m2 = 10; } }; class sports { public: int sm; void getsm() { sm = 10; } }; class statement:public student,public sports { int tot,avg; public: void display() { tot = (m1 + m2 + sm); avg = tot / 3; cout << tot; cout << avg; } }; int main() { statement obj; obj.get(); obj.getsm(); obj.display(); }
More Computer Questions
Which data structure is used for representing a grid where elements can be accessed by both row and column indices?
What is the correct way to declare a method named PrintMessage that prints a message to the console without taking any parameters or returning any value in C#?
A DBMS that combines a DBMS and an application generator is ________ .
GUI stands for
What is the Height of the root node of K-ary tree?