From: scochran AT shoalsnet DOT com Newsgroups: comp.lang.c++,comp.lang.c++.moderated,comp.os.msdos.djgpp Subject: Using one copy of class for many other classes Date: 27 Jun 1997 09:22:15 -0400 Organization: unknown Lines: 33 Sender: cppmods AT netlab DOT cs DOT rpi DOT edu Approved: dietmar DOT kuehl AT uni-konstanz DOT de Message-ID: <5p0epd$gtj@netlab.cs.rpi.edu> NNTP-Posting-Host: netlab.cs.rpi.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In C++ I've run into yet another brick wall. I have a class called arena that is a 50x50 arena for obstacles and robots (for now anyway). I'm running into problems because I only want to have one copy of the arena and multiple copies of the robots or whatever I want to put. Would I do it something like this? int robot::robot(arena arenacopy) { . . . } int robot::robofunction(void) { arenacopy.arenafunction(); } Would this work? Also I have an enum to define the objects in a buffer of the arena would it be best to derive a class from arena and put all the enum and enum specific (the ones that use the enums) functions there? Micah Cochran scochran AT shoalsnet DOT com [ Send an empty e-mail to c++-help AT netlab DOT cs DOT rpi DOT edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]