composition, i think
hey all, hope you're doing well :)
if i use a member function f_x of class x in a member function f_y of class y, do i need to declare member function f_x in class y? if so, how? is this composition? here's the error i'm getting:
game.obj : error LNK2001: unresolved external symbol "public: void __thiscall Game::mf_playerLineup_display(class Player *,class Player *,class Player *,class Player *,class Player *,class Player *,class Player *,class Player *,class Player *,class
erm...i dont know much about it, but i would think you only need to declare f_y in class y under public....i dunno, dont ask me
...how about a pointer to the function?
declare f_x as a public function of class X. make sure you include X's header in Y so that it knows it exists... then you can do this;
hey thanks all,
i got it to work but by declaring f_x in X like any other member function, it seems to work fine. which makes me think that this is not what my book calls composition. the book's example delt with data members, not functions, and also gave this odd constructor syntax:
if anyone can explain what the deal is with that constructor, i'd appreciate it. it came from pg 462, deitel & deitel 3rd ed.
X::x (int a, int b, int c)
:yData1_ofclass_x (int a, intb, int c)
:yData2_ofclass_x (int a, int b, int c)
// . . .
thanks again guys :)