c++ - Write the definition of the function print to output the values of the -
Note: I ask my teacher for help, but it is only active on Thursday ~ Sunday, so it's a long Wait.
In the class we are currently using: C ++ programming: Program design with data design
Everything was fine until up to Chapter 10, reaching classes, After reading chapter 2 again, I suspect that I will be able to understand myself, in the part of our homework, it asks that we:
print the definition of the function, for example Print to output values of variable T.
to:
class employee // line1 {// line2 public: // line3 employee (); // line 4 employee (string, int, double); // line5 employee (int, double); // line 6 staff (string); // line 7 zero set data (string, int, double); // Line 8 Zero print () CONST; // line 9 zero update pay (double x); // line 10 intem namsoffservice () cons; // line 11 double getPay () const; // line 12 private: // line 13 string name; // Line 14 NANFSS virus; // line 15 double pay; // line16};
Will such a thing appear?
Zero Employee :: Print () const {cout & lt; & Lt; Staff :: Employees & lt; & Lt; Endl; }
I think the real question is, how do you print the employee within a function?
Just print the member variable as usual:
void Staff :: Print () const {std :: cout & lt; & Lt; Name & lt; & Lt; '' & Lt; & Lt; NumOfServiceYears & lt; & Lt; '' & Lt; & Lt; Payment & lt; & Lt; '\ N'; }
Comments
Post a Comment