任何人都告诉我如何调用流>>
运算符为抽象类指针的二维对象在main中。流运算符和抽象类
我想为基类中所有派生类的私有成员赋值。可能吗 ?怎么样?
istream & operator>>(istream& input,empolye &p)
{
cout << "Enter department type:";
input >> p.type;
cout << "Enter available bed:";
input >> p.avilable_bed;
cout << "Enter type of empolye ";
input >> p.empolye_type;
cout << "Enter empolye name";
input >> p.name;
cout << "Enter age";
input >> p.age;
cout << "Enter date of join";
input >> p.dateOfjoin;
}
我希望每个人都能够得到我的问题。 谢谢大家。
是的,但类型,名称等将需要是提供数据引用的函数 –
感谢Mr.Richard – Nouman
您的意思是派生类除了'employee'中还有'private'成员,并且调用了一个call像'std :: cin >> my_employee;'应该允许用户为他们输入值? –