Article View: comp.std.c++
Article #2574Re: Overloading of inherited operations?
From: David Harley
Date: Tue, 14 Nov 1995 20:38
Date: Tue, 14 Nov 1995 20:38
36 lines
1636 bytes
1636 bytes
Steve Clamage (clamage@Eng.Sun.COM) wrote:
: In article 021F9BA0@slip6-2.acs.ohio-state.edu, Sergey Zhupanov <sergey@cis.ohio-state.edu> writes:
: >Folks,
: >
: >Can derived functions overload each other instead of hiding
: >or (worse yet) producing ambiguity?
[ eg. foo(char) hides foo(int) in a superclass ]
[ Steve responds ... ]
: A using-directive will solve your problem without generating any extra code.
: class B1 { public: int foo(int); };
: class B2 { public: int foo(char); };
: class D : public B1, public B2 {
: public:
: using B1::foo; // "using" applies to a name, not to a signature
: using B2::foo;
: double foo(double); // new overload
: };
[ snip ]
I have never understood why an overloaded member of a subclass hides a
superclass's member. It seems to be illogical and contradicts the
behaviour of non-class members. (It is also very irritating.)
What is 'using'? It does not seem to be standard.
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<48adgo$779@aztec.co.za>Path:
arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!MattReferences:
<01BAB117.021F9BA0@slip6-2.acs.ohio-state.edu> <487vm5$ook@engnews1.eng.sun.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!Matt From: dharley@aztec.co.za (David Harley) Newsgroups: comp.std.c++ Subject: Re: Overloading of inherited operations? Date: 14 Nov 1995 20:38:56 GMT Organization: Aztec Public Access Internet Approved: Matt@Austern Message-ID: <48adgo$779@aztec.co.za> References: <01BAB117.021F9BA0@slip6-2.acs.ohio-state.edu> <487vm5$ook@engnews1.eng.sun.com> NNTP-Posting-Host: austern.hip.berkeley.edu