Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!uflorida!travis!tom From: tom@ssd.csd.harris.com (Tom Horsley) Newsgroups: comp.std.c++ Subject: Re: template base classes Message-ID: Date: 5 Mar 91 16:00:06 GMT References: Sender: news@travis.csd.harris.com Distribution: comp Organization: Harris Computer Systems Division Lines: 25 In-reply-to: ahuttune@niksula.hut.fi's message of 5 Mar 91 13:19:30 GMT >NormalLamp and MagicalLamp have a way to store some class specific information >that is local to that class, but is only defined in the base class. >THERE WAS NO NEED FOR THE PROGRAMMER OF THE DERIVED CLASSES TO KNOW HOW >THIS INFORMATION IS STORED AND THERE WAS NO 'EXTRA WORK'. >Using traditional C++ programming facilities the programmer would have been >forced to write the static members in the derived classes by hand. I have not been following the c++ standard very closely, but I had always assumed this sort of thing would be possible with templates. (For a more useful example than nethack, you might want to look at the convolutions the NIH library has to go through with macros used to define classes). If this is really not possible with the current template proposals, I am all in favor of adding something to allow it. I have often wanted some way to automatically derive new static members for classes (consider the use for something like a cache for class specific information). -- ====================================================================== domain: tahorsley@csd.harris.com USMail: Tom Horsley uucp: ...!uunet!hcx1!tahorsley 511 Kingbird Circle Delray Beach, FL 33444 +==== Censorship is the only form of Obscenity ======================+ | (Wait, I forgot government tobacco subsidies...) | +====================================================================+