[Exceptional C++ Style] Item 17 - Encapsulation

Adrian Fagg adrianf at evaluategroup.com
Mon Dec 20 08:43:09 EST 2004


> -----Original Message-----
> From: effective-cpp-bounces at accu.org
> [mailto:effective-cpp-bounces at accu.org]On Behalf Of solosnake .
> Sent: 20 December 2004 13:12

> // Case 1 : Encapsulated data.
> class Case1
> {
> public:
>     const SomeData& GetSomeData()const;
> private:
>     const someData_;
> };
>
> // this could also be inlined instead.
> const SomeData& Case1::GetSomeData()const
> {
>     return someData_;
> }

Hey, hold on - that's giving you a pretty strong dependency on its internals
as well isn't it?

Regards,

Adrian

Work: mailto:adrianf at evaluategroup.com
Home: mailto:adrian.fagg at ntlworld.com

Pretty pictures: http://homepage.ntlworld.com/rbyadf/




More information about the Effective-cpp mailing list