Select the correct option to test your answer:
Computer
Plus Plus Miscellaneous
Difficulty: Medium
What will be the output of the following C++ code? #include <iostream> using namespace std; class BaseClass { int i; public: void setInt(int n); int getInt(); }; class DerivedClass : public BaseClass { int j; public: void setJ(int n); int mul(); }; void BaseClass::setInt(int n) { i = n; } int BaseClass::getInt() { return i; } void DerivedClass::setJ(int n) { j = n; } int DerivedClass::mul() { return j * getInt(); } int main() { DerivedClass ob; ob.setInt(10); ob.setJ(4); cout << ob.mul(); return 0; }
More Computer Questions
In the expression x <- 4 in R, what is the class of 'x' as determined by the `class()' function?
Which member function is used to determine whether the stream object is currently associated with a file?
What will be the output of the following Python code? def C2F(c): return c * 9/5 + 32 print C2F(100) print C2F(0)
Computers manipulate data in many ways, and this manipulation is called___________?
What will be the output of the following Java program? class X { int a; double b; } class Y extends X { int c; } class Output { public static void main(String args[]) { X a = new X(); Y b = new Y(); Class obj; obj = b.getClass(); System.out.print(obj.getSuperclass()); } }