delorie.com/archives/browse.cgi | search |
From: | mert0236 AT sable DOT ox DOT ac DOT uk (Thomas Womack) |
Newsgroups: | comp.lang.c++,comp.os.msdos.djgpp,rec.games.programmer |
Subject: | Re: pointer to function ?? |
Followup-To: | comp.lang.c++,comp.os.msdos.djgpp,rec.games.programmer |
Date: | 15 Feb 1998 23:36:21 GMT |
Organization: | Oxford University, England |
Lines: | 46 |
Message-ID: | <6c7u5l$mub$2@news.ox.ac.uk> |
References: | <6c7ltq$ms1$1 AT o DOT online DOT no> |
NNTP-Posting-Host: | sable.ox.ac.uk |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
[iC] (jan AT narvik DOT crosswinds DOT net) wrote: : ok, this might sound like a stupid question, but any way: : I have a class witch looks somthing like this : : class Man { : int x,y,z; : --------- : void nextthink(); : } : what I need is to be able to do somthing like : : nextthink() = run(); : or : nextthink() = attack(); : later on in the game... Wouldn't it be easier, and not discernably slower, to put int nextthink; nextthink=THINKER_RUN; nextthink=THINKER_ATTACK; switch nextthink { case THINKER_RUN: run(); case THINKER_ATTACK: attack(); } Tom
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |