Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsm!grunwald From: grunwald@uiucdcsm.cs.uiuc.edu Newsgroups: comp.lang.c++ Subject: Re: constructors Message-ID: <4800009@uiucdcsm> Date: Sun, 29-Nov-87 15:25:00 EST Article-I.D.: uiucdcsm.4800009 Posted: Sun Nov 29 15:25:00 1987 Date-Received: Wed, 2-Dec-87 22:58:45 EST References: <4162@watdcsu.waterloo.edu> Lines: 25 Nf-ID: #R:watdcsu.waterloo.edu:4162:uiucdcsm:4800009:000:565 Nf-From: uiucdcsm.cs.uiuc.edu!grunwald Nov 29 14:25:00 1987 you need to say what you mean, not what you're used to saying. i.e. don't look at it as building a struct. look at it as a class: class Bitmap { int width; int height; char *theMap; public: Bitmap(int xwidth, int xheight) { width = xwidth; height = xheight; int bytes = ((width + 7) / 8) * height; theMap = new char[byte]; } ~Bitmap() { delete theMap; } } this way, when you 'delete' a Bitmap, you also delete the store associated with it (because its destructor is called). you could also declare member functions like 'rasterOp' and the like.