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

List:       kde-devel
Subject:    Re: Some thoughts on kdelibs et al.
From:       John Gluck <jgluckca () home ! com>
Date:       2001-09-25 15:47:09
[Download RAW message or body]

Hi

I agree that it is better to provide accessor methods that are either public or
protected than direct access as long as the accessors are inline.

As far as the removal of QLineEdit goes....
I believe it should not be removed. There are 2 choices. One is to simply make
another class that uses a combobox, the other is allow the user to select which he
wants in the constructor.
I prefer the first.

John

Martijn Klingens wrote:

> On Mon, 24 Sep 2001, Richard Moore wrote:
> > Actually, I'd say it's highly likely that the QLineEdit in this class *will*
> > be removed. It should be a combo box in order to support a history. If thee
> > code had been written to use an accessor method to obtain the QLineEdit
> > pointer then this could have been accomodated without breaking source
> > compatibility (using the QLineEdit accessor in QComboBox). Giving direct
> > access to member variables is almost always the wrong choice, and should be
> > avoided.
>
> I think the much better approach would be to make _all_ data members
> private, but provide access to them by means of an accessor method:
>
> class foo
> {
> public:
>   foo();
> private:
>   int m_myMember;
> protected:
>   int myMember();
>   void setMyMember( int m );
> };
>

[snip]

 
>> 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