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 |
What is the use of namespace std in C++?
Define anonymous class.
In a class only declaration of the function is there but defintion is not there then what is that function?
What is the difference between a definition and a declaration?
Explain the isa and hasa class relationships. How would you implement each?
What is the difference between prefix and postfix versions of operator++()?
Is there structure in c++?
What is the difference between public, private, and protected access?
How can you force instantiation of a template?
Explain mutable storage class specifier.
What is scope in c++ with example?
What is abstraction with real time example?