We are interested in providing a class, say class A, with an overloaded operator << for output. You can’t put a using directive or declaration in a function header. There are three ways to make namespace names available in a declaration of an overloaded operator<< Give two of the three ways to declare an overloaded operator << Give the #include, assume that class A has been defined, then define a stand-alone operator<< function for output of a class. Only give the two declarations, not the implementation, of such overloaded functions.
What will be an ideal response?
An answer that qualifies
```
ostream
#include
// assume class A has been defined
std::ostream& operator<<(std::ostream& outStr,
const A& ObjectOut);
```
This answer makes only the name ostream available using declaration:
```
#include
// assume class A has been defined
using std::ostream;
ostream& operator<< (ostream& outStr,
const A & ObjectOut);
```
Yet another that uses a using directive is:
```
#include
// assume class A has been defined
using namespace std;
ostream& operator<< (ostream& outStr,
const A & ObjectOut);
```
You might also like to view...
Replacing inadequate superclass methods with more suitable subclass methods is known as __________.
a. method upgrading b. tactical inheritance c. method overriding d. method overloading
Math.cos(Math.PI) returns _______.
a. 0.0 b. 1.0 c. -1.0 d. 0.5
Maintenance should be viewed as a separate step in the software development life cycle. _________________________
Answer the following statement true (T) or false (F)
C++, Visual Basic, C#, Python, and Java are all examples of what kind of language?
A. assembly B. machine C. programming D. mnemonic