[Exceptional C++ Style] Fw: const data - was Item 17

Paul Grenyer paul at paulgrenyer.co.uk
Wed Dec 22 06:40:45 EST 2004


Hi

> I don't have a copy of the book (I've sort of been co-erced into the group 
> by Paul ;-).

That's so unlike me. ;-)

> Would it be ok to show me 17-a and 17-b? I won't be able to get a copy of 
> the book for a while now...

// Example 17-2(a): Nonprivate data (evil)
//
class X {
    // ...
public:
    T1 t1;
protected:
    T2 t2_;
};

// Example 17-2(b): Encapsulated data (good)
//
class X {
    // ...
public:
    T1& UseT1() { return t1_ };
protected:
    T2& UseT2() { return t2_ };
private:
    T1 t1_;
    T2 t2_;
};

Also, I'm down your way from the 24th to the 29th. If you want to have a 
flick through my book during that period I'll have it with me.

Regards
Paul

Paul Grenyer
email: paul at paulgrenyer.co.uk
web: http://www.paulgrenyer.co.uk
Elephant: http://www.paulgrenyer.dyndns.org/elephant/

Darrell "Dimebag" Abbott will be sorely missed. 




More information about the Effective-cpp mailing list