Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sgi!thant@horus.SGI.COM From: thant@horus.SGI.COM (Thant Tessman) Newsgroups: comp.sw.components Subject: Re: What kinds of keys do you sort? Summary: C++ vs Ada or Objective C or ... Message-ID: <32424@sgi.SGI.COM> Date: 10 May 89 01:23:23 GMT References: <7032@saturn.ucsc.edu> <32269@sgi.SGI.COM> <5674@microsoft.UUCP> Sender: daemon@sgi.SGI.COM Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 35 In article <5674@microsoft.UUCP>, paulc@microsoft.UUCP (Paul Canniff 2/1011) writes: > > Wkat C++ are you using? How do you feel it stacks up vs. Ada for > building "components"? I don't know Ada. I don't even know what C++ I'm using except that it's the one that we (Silicon Graphics) is using internally. It's not officially supported yet, but they are giving it to people with an AT&T C++ liscense. My big hangup with C++ has to do with taking the address of member function. The 'proper' way requires that you know the type of class the member function belongs to. But the reason I wanted to use function pointers was so I could store a function without knowing anything about it. The way to cheat is to cast the member function to a pointer to a function that takes a void* as its argument. When you call the function you pass it the address of the object. The compiler complains, but it does work. The code isn't as type secure, and according to Bjarne the trick isn't guaranteed to work. The way I should solve my problem is to use a base class and overload a function. This is only practical in general if there is only one function the derived class wants to overload, because otherwise everything will have to agree on which functions to call when. I hear Objective-C deals with these problems by passing messages to class objects, so it doesn't matter what the object's class is as long as it knows how to do what you ask (like 'draw'). Does this make for slower code? I also hear Ob-C has a problem dealing with typing what gets passed back. I am very interested in how well software can be "componentized" with different languages. However, all I know is C++. Discussion? thant@sgi.com "I'm off to by a book on smalltalk"