C++ Programming - Objects and Classes - Discussion

Discussion Forum : Objects and Classes - Programs (Q.No. 14)
14.
Which of the following statement is correct about the program given below?
#include<iostream.h> 
class BixBase
{
    int x, y; 
    public:
    BixBase(int xx = 10, int yy = 10)
    {
        x = xx;
        y = yy;
    }
    void Show()
    {
        cout<< x * y << endl;
    }
};
class BixDerived
{
    private:
        BixBase objBase; 
    public:
    BixDerived(int xx, int yy) : objBase(xx, yy)
    {
        objBase.Show();
    }
};
int main()
{
    BixDerived objDev(10, 20);
    return 0; 
}
The program will print the output 100.
The program will print the output 200.
The program will print the output Garbage-value.
The program will report compile time error.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
3 comments Page 1 of 1.

Ayush said:   1 decade ago
Can any class's constructor be inherited by any other class's constructor when the other class does not inherit the first class.

Xzibit said:   1 decade ago
BixDerived(int xx, int yy) : objBase(xx, yy)

Initiator List for Bix Derived class.

Richa said:   8 years ago
cout x.y=10*20 = 200.

Post your comments here:

Your comments will be displayed after verification.