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().
Answers were Sorted based on User's Feedback
Answer / pankaj rathor
#include <iostream>
using namespace std;
class dummy
{
public:
dummy()
{
cout<<"Hai Arvind ";
}
~dummy()
{
cout<<" 99999999999";
}
};
dummy obj;
int main()
{
cout<<"my no. is";
return 0;
}
| Is This Answer Correct ? | 15 Yes | 2 No |
Answer / 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 |
How do you clear a map in c++?
Where must the declaration of a friend function appear?
What is the difference between method and message?
What are the uses of typedef in a program?
What is meant by entry controlled loop? What all C++ loops are exit controlled?
What does asterisk mean in c++?
differance between copy & clon
What are virtual functions and what is its use?
find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.
Are there any special rules about inlining?
What is the outcome of cout< a) 16 b) 17 c) 16.5
What is meant by the term name mangling in c++?