Re: ansi status of 'using'
From: Ioannis Vranos (ivr_at_guesswh.at.grad.com)
Date: 05/05/04
- Next message: ksharma: "Any idea why do this program crash when I throw derived object as shown ?"
- Previous message: Shailesh Humbad: "Re: [OT] Challenge response."
- In reply to: Mark Huppert: "ansi status of 'using'"
- Next in thread: Jeff Schwab: "Re: ansi status of 'using'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 5 May 2004 09:52:56 +0300
"Mark Huppert" <dustyoso@netspeed.com.au> wrote in message
news:40988873$1@mail.netspeed.com.au...
> Dear Colleagues
>
> re: 'using' and the ANSI C++ standard
>
> According to the ANSI C++ standard, is this a valid
> way (disregarding whether it is 'naughty') of converting a
> public method in the base class into a private method in the child class?
> My g++ compiler ignores this without comment.
>
> class parent{
> public:
> double length(double num) {return num; }
> };
>
> class child: public parent {
> public:
> double hiding(double num) {return length(num);}
> private:
> using parent::length;
> };
>
> ie, equivalent to:
> private:
> double length(double num) {return parent::length(num); }
No, but why doing this? You can do:
class parent{
public:
double length(double num) {return num; }
};
class child: private parent {
public:
double hiding(double num) {return length(num);}
};
Regards,
Ioannis Vranos
- Next message: ksharma: "Any idea why do this program crash when I throw derived object as shown ?"
- Previous message: Shailesh Humbad: "Re: [OT] Challenge response."
- In reply to: Mark Huppert: "ansi status of 'using'"
- Next in thread: Jeff Schwab: "Re: ansi status of 'using'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|