[Exceptional C++ Style] Fw: const data - was Item 17
Jon Jagger
jon at jaggersoft.com
Thu Dec 30 07:59:53 EST 2004
Balog Pal wrote:
> From: "Jon Jagger" <jon at jaggersoft.com>
>
>> Ultimately, as always, it boils down to a choice. I could use get
>> accessors in the class, declare those as operations in an interface,
>> and program to the interface. This would, as you say, allow me
>> handle-body if I wanted to. The problem is I don't want to. And I
>> cannot think of a reason why I'd want to.
>
>
> That's it. There are places abstraction does not makes sense, period.
>
>> If you can think of any reasons why I'd want to handle-body I would
>> be very interested to hear them. Remember the grammar does nothing.
>> It really is just data.
>
>
> that reminds the portion in this episode:
>
> http://www.objectmentor.com/resources/articles/xpepisode.htm
>
> where class Throw is discussed at the beginning.
>
Hmmm. But suppose I wanted to record not just the score for each bowl
but also the specific pattern of pins knocked down? In that case a Throw
class might be useful. (But a name better than Throw would be nice). As
always it depends. But I think that case is a bit different.
One of the reasons I'm "more ok" with the grammar containing public
const fields is because the fields are _not_ primitive types - they're
NonTerminal's which have structure of their own.
Cheers
Jon
More information about the Effective-cpp
mailing list