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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error C2228

Status
Not open for further replies.

iwtblj

Programmer
Joined
Jan 24, 2003
Messages
1
Location
US
When I try to compile the following code, I get an error that says "error C2228: left of '.addObject' must have class/struct/union type."

shelf<fruitJuice> storeJuice();
for(ctr=0; ctr < 5; ctr++)
storeJuice.addObject(juices[ctr]);

shelf is a template class with a constructor that takes 0 aruments. juices is an array of a different class.
 
Try to instantiate your object like this:

shelf<fruitjuice> storeJuice;

WITHOUT the brackets.



Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top