如何在PEemployee类的get_name()函数中创建指向成员的指针

时间:2019-05-09 15:37:42

标签: c++ class

这是我要解决的问题:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>Puresharp</authors>
    <owners>Puresharp</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$id$.$version$</description>
    <releaseNotes></releaseNotes>
    <copyright>$copyright$</copyright>
    <tags>Puresharp</tags>
  </metadata>
</package>
Implement a class PEmployee that is just like the Employee class except
that it stores an object of type Person as developed in Exercise P5.1.
class PEmployee
{
public:
 PEmployee();
 PEmployee(string employee_name, double initial_salary);
 void set_salary(double new_salary);
 double get_salary() const;
 string get_name() const;
private:
Person person_data;
 double salary;
};
class Person
{
public:
    Person();
    Person(string pname, int page);
    void set_name() const;
    void set_age() const;
private:
    string name;
    int age; // 0 if unknown
};
class PEmployee
{
public:
    PEmployee();
    PEmployee(string employee_name, double initial_salary);
    void set_salary(double new_salary);
    double get_salary() const;
    string get_name() const;
private:
    Person person_data;
    double salary;
};

我收到此错误:抑制状态错误C3867'PEmployee :: get_salary':非标准语法;使用“&”创建指向成员的指针;

0 个答案:

没有答案