Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!cbosgd!clyde!watmath!watdcsu!mgardi From: mgardi@watdcsu.waterloo.edu (M.Gardi - ICR) Newsgroups: comp.lang.c++ Subject: constructors Message-ID: <4162@watdcsu.waterloo.edu> Date: Thu, 26-Nov-87 09:07:44 EST Article-I.D.: watdcsu.4162 Posted: Thu Nov 26 09:07:44 1987 Date-Received: Sun, 29-Nov-87 20:48:50 EST Distribution: comp Organization: U of Waterloo, Ontario Lines: 25 Keywords: new,constructors being brand new to C++ programming, I have a few questions....it seems that 'reading' about c++ is fine...actually programming is another matter! I currently have a structure consisting of the following: struct bitmap { int length; int width; unsigned char *bitshp; } I would like to implement this as a class with an appropriate constructor. Would I normally declare a bitmap pointer in my declarations and then in my program simply write 'variable = new bitmap(length,width)' ? The real question I am wondering about is normally, I would allocate store for the bitshp using malloc(width * 8 * length). In my constructor, do I now use 'bitshp = new char[length * width * 8]' ? also, I guess my desctructor would now have to 'delete bitshp' and 'delete bitmap' ? thanks for any help peter devries