Cout Does not Name a Type
伙计们,为什么我在使用“iostream 和使用命名空间标准”时会收到此错误
这是我的代码
class DateType: public PatientType{
cout<<"\nEnter Patient ID\n";
cin>>Patient_ID;
cout<<"\nEnter Patient's Age\n";
cin>>Age;
cout<<"\nEnter Patient's Date of Birth";
cin>>DOB;
};
类 DateType 派生自类 PatientType,类 PatientType 派生自类 PersonType。
cout 在任何地方都有效,但在类 DateType 中除外。
最佳答案
cout<<"\nEnter Patient ID\n";
是一个语句,需要在函数中。
这和您的其他陈述都在类定义中的某处 float 。这在语法上是无效的。
这会混淆编译器并发出一个有点神秘的错误。
关于c++ - 多级继承错误 "cout does not name a type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40398786/