我的PinkBase * ContractType
存在问题。 PinkBase是一种类类型,它所在的客户类是一个存储客户数据的类。
以下是代码:
class PinkBase;
class Customer
{
private;
//all of my private data including:
PinkBase* ContractType;
public:
//all of my public Methods (gets and sets)
}
//I then run the constructor for my customer class:
Customer::Customer()
{
strcpy_s(FirstName, "");
strcpy_s(SecondName, "");
ContractType = NULL; //this is the issue, the class compiles fine, however.
TextsUsed = 0;
Minutes080Used = 0;
MinutesUsed = 0;
DataUsed = 0;
}
// the errors come when I start to calculate the bills and use code like this:
double Customer::calculateBill()
{
textRange = TextsUsed - ContractType->getTextsAllowed();// this should return the amount of allowed texts
}
我收到错误(c2227)抱怨我的" - >"符号的左侧应该指向一个类/结构。据我所知,就是这样。
错误如下:
Error 1 error C2027: use of undefined type 'PinkBase' c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 66 1 PinkMobile
Error 2 error C2227: left of '->getTextsAllowed' must point to class/struct/union/generic type c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 66 1 PinkMobile
Error 3 error C2027: use of undefined type 'PinkBase' c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 74 1 PinkMobile
Error 4 error C2227: left of '->getMinutes080Allowed' must point to class/struct/union/generic type c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 74 1 PinkMobile
Error 5 error C2027: use of undefined type 'PinkBase' c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 82 1 PinkMobile
Error 6 error C2227: left of '->getMinutesAllowed' must point to class/struct/union/generic type c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 82 1 PinkMobile
Error 7 error C2027: use of undefined type 'PinkBase' c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 90 1 PinkMobile
Error 8 error C2227: left of '->getDataAllowed' must point to class/struct/union/generic type c:\users\administrator\desktop\pinkmobile - 15 th - 2\pinkmobile\contracts.h 90 1 PinkMobile