YkI
YkI

Reputation: 29

define class and pointer in c++

I have this main: (part of the code).

int main ()
{
Person* pPerson;
ifstream file ("data.dat", ios::binary);
pPerson = personFactory::getPersonFromFile(file);
...
}

Can I define the calls that...? (part of the class).

class personFactory{
public:
...
Person* getPersonFromFile (ifstream& inFile);
...
};

Upvotes: 0

Views: 66

Answers (1)

Leo Chapiro
Leo Chapiro

Reputation: 13979

I think if your call looks like

personFactory::getPersonFromFile(file)

you need to have it static

 static Person* getPersonFromFile (ifstream& inFile);

Upvotes: 1

Related Questions