Answer to Question #222498 in C++ for Jaguar

Question #222498
(c) Consider the partial class declaration of an Employee class below:

class Employee: protected Person{
public:
//...
double Rate;
double GetRate() const;
double GetHours() const;
private:
double Hours;
//...
protected:
double Pay() const;
//...
};

Line 1: cout << E.GetName();
Line 2: cout << E.GetHours();
Line 3: cout << E.Address;
Line 4: cout << E.GetRate();
Line 5: cout << E.Rate;
Line 6: cout << E.Pay();

(ii) Explain why the following implementation of function Pay()would result in a
compilation error.
1
Expert's answer
2021-08-04T02:06:44-0400

The Pay() would result in error because it is defined as a protected member of the class Employee and therefore it cannot be accessed in the main function.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS