Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site sdcc7.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcc3!sdcc7!ee178acb From: ee178acb@sdcc7.UUCP (DARIN JOHNSON) Newsgroups: net.lang Subject: C++ help needed Message-ID: <188@sdcc7.UUCP> Date: Tue, 26-Nov-85 14:27:30 EST Article-I.D.: sdcc7.188 Posted: Tue Nov 26 14:27:30 1985 Date-Received: Thu, 28-Nov-85 23:58:22 EST Organization: U.C. San Diego, Academic Computer Center Lines: 45 Keywords: separate compilation A need a few answers to some C++ questions. But first, a bug. This code does not compile. Moving class inner outside of class outer will cause the thing to compile normally. class outer { class inner { int inner_data; }; int outer_data; public: int inner_val(inner*); }; int outer.inner_val(inner *x) { return x->inner_data; }; I want to implement various forms of trees without letting the application module know what type of trees they are. This means that the same header file should be the interface for all implementations. Distance fields should be invisible, as well as whether binary, or B+ trees are used. Is there a way to do this? My solution was to use a #ifdef which to me is a hack. Is there a nice way to do this with a modula-2 type of interface? In c, I did this sort of thing simulating an Ada "private" type by having a create function pass back a pointer to a structure, but the application module thought this was a pointer to a char, int, or whatever. Is this type of thing do-able in C++ without using "pure" c, but using the data-abstraction available? Also, when trying to do this sort of thing, I ran across the problem of friend functions that I don't want the user to know about. For example, a merge function that the member functions call, but which should be private to everyone else. Is there a way to do this? C++ is a good improvement on many of c's limitations, but separate compilation has a ways to go before is can place itself next to Ada or modula-2, etc. Darin Johnson trying to figure it out before the students complain. sdcsvax!beowulf!wbreader