A
Anon Email
Hi people,
Another question. In the code below, why is there a screen output?
This part of the code:
bool status = TheCalculator.Execute(input);
is merely assigning the result of the function call to status. In
fact, I don't understand why I am allowed to perform this assignment
at all, since the Execute method contains more than just a boolean
return. Any advice appreciated.
Cheers,
Deets
Code:
-------------
#include <iostream>
using std::cout;
using std::endl;
class Input {};
class Calculator
{
public:
bool Execute (Input & input)
{
cout << "Why does this text output to screen?\n";
return true;
}
};
int main()
{
Calculator TheCalculator;
Input input;
bool status = TheCalculator.Execute(input);
}
Another question. In the code below, why is there a screen output?
This part of the code:
bool status = TheCalculator.Execute(input);
is merely assigning the result of the function call to status. In
fact, I don't understand why I am allowed to perform this assignment
at all, since the Execute method contains more than just a boolean
return. Any advice appreciated.
Cheers,
Deets
Code:
-------------
#include <iostream>
using std::cout;
using std::endl;
class Input {};
class Calculator
{
public:
bool Execute (Input & input)
{
cout << "Why does this text output to screen?\n";
return true;
}
};
int main()
{
Calculator TheCalculator;
Input input;
bool status = TheCalculator.Execute(input);
}