given the code segment below
void main()
{
cout<<"my no. is";
}
question is how can we get the output hai aravind my no. is
99999999999 without editig the main().
Answer Posted / sunil chopra
Overload the << operator.
ostream& operator << (ostream& ot, const char* chr)
{
using std::operator<<;
return ot << "Hai Arvind " << chr << " 99999999999";
}
| Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
What is purpose of new operator?
Explain data encapsulation?
Explain the volatile and mutable keywords.
Which operations are permitted on pointers?
What are friend classes? What are advantages of using friend classes?
Explain the concept of copy constructor?
Can we change the basic meaning of an operator in c++?
How do you generate a random number in c++?
What is the use of map in c++?
Does std endl flush?
Can user-defined object be declared as static data member of another class?
Explain what is class definition in c++ ?
What are member functions used in c++?
What are the advantages of pointers?
Is there a sort function in c++?