[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: accessing protected members of a parent class
From:       "Dirk Mueller" <dmuell () gmx ! net>
Date:       2002-04-04 22:44:46
[Download RAW message or body]

On Don, 04 Apr 2002, Lubos Lunak wrote:

>  I just can't find anywhere why it's supposed to (not) work that way, and how 
> to do it correctly (I can't think of anything better than friendship, and 
> that's IMHO stupid and worse than allowing the access via the pointer).
>  Does somebody know?

Well, the "correct" way would be to upgrade the base class protected member 
to public in the derived class. 

It is at least more portable than suggesting a #define protected public 
hack. you should never ever use something like that!

"upgrading" works by using: 

class B : public A {

public:

   using A::foo();

};


Dirk
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic