我创建了一个woker 基类 ,派生了一个employee类,然后创建一个如下的woker类型的指针,进行初始化,
woker* a = new employee(1, "wxx", 1);、
这是基类和派生类的构造函数
```c++
class woker
{
public:
virtual void showinfo() = 0;
virtual void getdepaname() = 0;
int num = 0 ;
string name;
int depanum = 0;
};
class employee : public woker
{
public:
employee(int temnum, string temname, int temdepanum)
{
this->num = temnum;
this->name = temname;
this->depanum = temdepanum;
}
int num ;
string name;
int depanum;
};
```
然后你的问题是?
a->num是你的基类的num