104k views
5 votes
Assume the existence of a File class with boolean data member, isValid, indicating the file is ready for I/O. Write a unary operator, !, that accepts a constant File reference, and returns true if the file is not ready for I/O and false otherwise.

User Icycandy
by
4.7k points

1 Answer

4 votes

Answer:

The description for the given question is described in the explanation section below.

Step-by-step explanation:

In reality, the "!" operator remains overloaded throughout the library of IO-stream, which effectively comes back the contrary feature of good.

It's how that they would load the "!" operator to construct a unary member overloading feature.

Example:

class abc

{

public :

bool isValid ( ) // return true

bool operator ! ( ) // return isValid( )

};

Optionally, to overwhelm the unary, you may build a global feature "!" user.

User Alexizamerican
by
6.1k points