Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!ucsd!ogicse!plains!jmork From: jmork@plains.NoDak.edu (James Mork) Newsgroups: comp.lang.c++ Subject: Angry new C++ programmer: GENERIC CODE? Message-ID: <6907@plains.NoDak.edu> Date: 24 Nov 90 00:20:10 GMT Organization: North Dakota State University, Fargo Lines: 41 I am still digging my way into C++ but I am angry to find no facilities for generic code--as in Ada. Can you do this? Why didn't they put this in? In Ada, for example, one can create a GENERIC package (class) called--say-- BTREE. All of the btree operations can be defined and the package can be instantiated by the compiler. What is the best way to do something like this? I have Turbo C++ which includes a number of examples and a class library. It would be nice to be able do define a derived class class in a similar way as Ada does, however, and just be able to say: class int_btree : public btree(int) { // int specs type of btree ------------- Assuming you could specifiy a generic class something like this... class btree(tree_type) { tree_type value; btree(unsigned maxnodes); ~btree(); int add(tree_type value); int delete(tree_type value); int exists(tree_type value); ... } ------------------------ Can you do anything with this effect without having to define a base class called OBJECT and derive a class BTREE from object... and all of that? Maybe I am just not deep enough into this yet... Any response is greatly appreciated Thanks, Jim -- UUCP Bitnet Internet uunet!ndsuvax!numork numork@ndsuvax numork@plains.nodak.edu