Xref: utzoo comp.lang.c++:12800 comp.std.c++:818 comp.object:3113 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!mnemosyne.cs.du.edu!cag From: cag@mnemosyne.cs.du.edu (Chris Gantz) Newsgroups: comp.lang.c++,comp.std.c++,comp.object Subject: C++ possible new construct proposal Message-ID: <1991Apr11.155803.5410@mnemosyne.cs.du.edu> Date: 11 Apr 91 15:58:03 GMT Organization: University of Denver, Dept. of Math & Comp. Sci. Lines: 72 Hello C++ netters, I don't know if this subject has been address before on the net, but I have been thinking about a possible C++ implementation of the following Object Oriented Programming Concept that may be useful for the development of large systems. The Concept is being able to utilize a "Type" as though it were an object. This mechanism could be valuable because it would allow a logically clean way of managing type information. That is, information that is relevant only to types and not logically relevant to instances of a type. Below is an example that illustrates a simple declaration and use within the C++ framework. class X { type: private: // internal data representation for type; int no_instantiations; protected: // protected interface for type; public: int instantaitions() { return instantiations; } void update_instantiations() { no_instantitations++; } object: private: // internal data representation for objects; protected: // protected interface for objects; public: X() { // default constructor update_instantiations() // object appropriate internal data initialization. } ~X() { } void f() { } }; main() { X x_obj; x_obj.f(); // using x_obj through the object public interface // below is an example of using the type X as an object... no_current_instantiations = X.instantiations(); } I believe that this language inclusion would integrate nicely with what is already available and not add any new anomalies in the language.. Well I have on my asbestos suit on, so flame away people, but I do hope that some people will consider the possible addition useful. Chris Gantz Dept. of Math & Computer Science Internet: cag@mnemosyne.cs.du.edu RM 306, JGH cgantz@diana.cair.du.edu University of Denver cag@aragtap.den.mmc.com Denver, CO 80208 Voice: (303) 871-3095 Martin Marietta Corp. Internet: cag@airob.mmc.com M/S XL4370 cag@maxai.den.mmc.com P.O. Box 1260. cag@aragtap.den.mmc.com Denver, CO 80201-1260 Voice: (303) 971-3347 -- Chris Gantz Internet: cag@mnemosyne.cs.du.edu Dept. of Math & Computer Science cgantz@diana.cair.du.edu University of Denver cag@aragtap.den.mmc.com Denver, CO 80208 Grad. Student