0

I have an issue with my PinkBase * ContractType. PinkBase is a class type, and the customer class it is in is a class to store data about the customer.

Here is the code:

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
}

I get an error (c2227) complaining that my "->" notation's left side SHOULD be pointing to a class/struct. To the best of my knowledge, IT IS.

Errors are as follows:

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
Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
JohnTheDemon
  • 21
  • 1
  • 5

0 Answers0