[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weird list.begin() error

From: Thomas
Subject: Re: weird list.begin() error
Date: Fri, 05 Nov 2004 08:02:42 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041101

Ralf Fassel wrote:
| class PlayList{
| public:
|     PlayList(){l.push_back("String 1");     l.push_back("String
| 2");l.push_back("String 3");}
| | ~PlayList(){;}
|     list<string>* getList() {return &l;}
| protected:
|       list<string> l;
| };

There is no point in having a `protected' data member if you allow
direct access to it via the getList() function.

Thanks for pointing that out R'. But this is only a demo program. In my actual program the pointer being returned is a const.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]