C++ Programming - Functions - Discussion

Discussion Forum : Functions - Programs (Q.No. 36)
36.
What will be the output of the following program?
#include<iostream.h>
#include<string.h> 
class BixString
{
    char x[50]; 
    char y[50]; 
    char z[50]; 
    public:
    BixString()
    { }
    BixString(char* xx)
    {
        strcpy(x, xx); 
        strcpy(y, xx);
    }
    BixString(char *xx, char *yy = " C++", char *zz = " Programming!")
    {
        strcpy(z, xx); 
        strcat(z, yy); 
        strcat(z, zz);
    } 
    void Display(void)
    {
    cout<< z << endl;
    } 
}; 
int main()
{
    BixString objStr("Learn", " Java");
    objStr.Display();
    return 0; 
}
Java Programming!
C++ Programming!
Learn C++ Programming!
Learn Java Programming!
Learn Java C++ Programming!
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
1 comments Page 1 of 1.

Abhika said:   6 years ago
The option is D because "learn" goes to the argument xx.

And "java" goes to yy and the value is overwritten by "java" and programming which is defined inside class is been printed as zz value.

Post your comments here:

Your comments will be displayed after verification.