Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

must have class/struct/union type

Status
Not open for further replies.

paulstat

Programmer
Jan 7, 2002
2
GB
Ok I'm trying to print out a returned integer such as.

moneyBag.getCred();

Now i'm trying it in the following way.

void interface1(Bank* moneyBag) {

cout << moneyBag.getCred();

}

But I get the following error, any suggestions?

left of '.getCred' must have class/struct/union type
 
That's a pointer you are using there as parameter in the function declaration Bank*.
When accessing pointers in classes/structures/unions, u have to use -> operator, like:
Code:
   cout << moneyBag->getCred();

That's all folks! [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top