Re: objects as parameters

From: Francis Glassborow (francis_at_robinton.demon.co.uk)
Date: 05/14/04


Date: Fri, 14 May 2004 09:50:29 +0100

In message <_tqdnVxfq6lTvznd4p2dnA@comcast.com>, Anthony C
<AntMJ2317@comcast.net> writes
>I wrote a simple game in c++ and it uses a class object(cat) that ive
>custom made. My question is this, i do not want to put a lot of code
>into main as the code becomes jumbled and very unreadable with 4 pages
>of code. I need to know how to pass my cat object(for example Garfield
>in this case) as a parameter into another function. I've tried a few
>things, but obviously have had no luck, any help is welcomed :-)

Well if you want Garfield to do things to other object pass him around
by const reference. If you want him to do things to himself, or have
things done to him that change him pass him around by reference. If you
do not understand what this means it is time to do some more study.

-- 
Francis Glassborow      ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects


Relevant Pages

  • Re: WJF videos
    ... After seeing the video of stuff 'Anthony can't do' I really lost the ... already little respect I had for Jason Garfield... ... it on doubles he just does it on doubles, and btw isn't it supposed to ... can't catch 4 clubs in one hand... ...
    (rec.juggling)
  • objects as parameters
    ... I wrote a simple game in c++ and it uses a class objectthat ive ... custom made. ... I need to know how to pass my cat object(for example Garfield ... things, but obviously have had no luck, any help is welcomed :-) ...
    (alt.comp.lang.learn.c-cpp)