Hi,
How do you call a class method inside a different class method? Here's what I have:
Code:
void cMenu::mission1()
{
cInventory.printInventory();
}
Code:
void cInventory::printInventory()
{
mItems = mBlade + mRope + mStick + mPole + mString + mKnife + mStars +
mBo + mSword + mBowArrow;
cout << "Total Items: " << mItems << endl << endl;
cout << "Loose inventory: " << endl;
cout << "---------------- " << endl;
cout << "Blade: " << mBlade << endl;
cout << "Rope: " << mRope << endl;
cout << "Stick: " << mStick << endl;
cout << "Pole: " << mPole << endl;
cout << "String: " << mString << endl;
cout << endl;
cout << "Finished Weapons: " << endl;
cout << "----------------- " << endl;
cout << "Knife: " << mKnife << endl;
cout << "Stars: " << mStars << endl;
cout << "Bo: " << mBo << endl;
cout << "Sword: " << mSword << endl;
cout << "Bow and Arrow: " << mBowArrow << endl << endl;
}
Here's my error. I think it's because I have declared the variables in cInventory private but I am not sure if that's what it is. I have included cInventory's header file in cMenu.
Code:
1>g:\exercises\village warrior\cmenu.cpp(59) : error C2143: syntax error : missing ';' before '.'
Thanks so much.