Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond!diamond From: diamond@diamond.csl.sony.junet (Norman Diamond) Newsgroups: comp.lang.c++ Subject: Re: nit picking questions Message-ID: <10161@socslgw.csl.sony.JUNET> Date: 13 Apr 89 05:29:14 GMT References: <161@riunite.ACA.MCC.COM> <9189@alice.UUCP> Sender: news@csl.sony.JUNET Reply-To: diamond@diamond.csl.sony.jp (Norman Diamond) Organization: /usr/lib/news/organization Lines: 59 In article <9189@alice.UUCP> bs@alice.UUCP (Bjarne Stroustrup) very kindly answers most of the questions that were asked by Ron Guilmette. If Mr. Stroustrup has time, please kindly try to answer some of them again. >Is it legal for an "operator delete" to return anything other than >type "void"? >***> Yes. It can take an additional argument of type long (a size) What about the _return_ type? >If a method member is declared in a derived class, can it be >redeclared in a derived class as a data member? >***> No (assuming you mean in the same derived class). You can only > overload functions. Mr. Guilmette must have meant: If a method member is declared in a _base_ class, can it be redeclared in a derived class as a data member? (method member == member function) >If this kind of redeclaration is allowed, what would the expression >&class_name::member_name yield in such cases? >***> It isn't. Probably it is, when the preceding question is corrected. Isn't the rule the same, finding the most derived type in the class lattice? >Is it legal or illegal to try to take the address of an overloaded >method or function using the '&' operator? Given a particular >overloaded function or method that you absolutely *must* get the >address of, is there any way of uniquely specifying a particular >one of the overloadings? >***> Yes. See the reference manual section 8.9. Essentailly, you can > only take the address of an overloaded function if the context > uniquely identifies which version. How do you provide the context? Mr. Guilmette's suggestion (following) seems very reasonable. > Specifically, is the following allowed >(or will it ever be)? > > &class_name::overloaded_method_name(int,int) >***> no and no (that would be ambiguous with a call) It would not be ambiguous. & cannot be applied to the result of a call. More obviously, "int" cannot be an actual parameter of a call, only an expression can be, but this does not help when a function takes no parameters. ------ cut here and discard everything below this point. ------ >Can a union have public, private and protected parts? >Can a union contain member functions? Gee, I thought the most interesting unions are those of private parts, one of which is a ... Never mind. Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-inventing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?