Re: Lahman, how ya doing?
- From: glhansen@xxxxxxxxxxxxxxxxxxxxx (Gregory L. Hansen)
- Date: Sat, 7 May 2005 23:52:23 +0000 (UTC)
In article <d5iuj1$pl7$1@xxxxxxxxxxxxxxxxxxxxx>,
Andrew McDonagh <news@xxxxxx> wrote:
>Gregory L. Hansen wrote:
>> In article <0%Qde.43511$4v.31435@trndny03>,
>> H. S. Lahman <hsl@xxxxxxxxxxxxxxxxx> wrote:
>>
>>>Responding to Hansen...
>>
>>
>>>class EventElement
>>>{
>>>private:
>>> Object* recipient;
>>> int event_id;
>>> int tick_count;
>>>public:
>>> EventElement (Object* r, int e, int t)
>>> {recipient = r; event_id = e; tick_count = t;};
>>> int getTickCount() {return tick_count;};
>>>}
>>
>>
>> Let me ask you, why is this a class? I usually think of classes as
>> something with member functions that do things with the data. I would
>> have used a struct as a passive holder of data.
>>
>>
>
>For one thing, it allows us to create instances which are immutable objects.
>
>For another, we can use polymorphic calls with a class over a struct
>('c' struct I take it you mean - as C++ structs are the same as Classes
>but with different default access rights).
Thanks, Andrew, but I'm not sure that meant anything to me.
Immutable objects? Can't be changed? Is that better than a const struct?
I could use more words on the second paragraph, if you don't mind. Why
is a polymorphic call with a class over a struct a good thing?
--
"The polhode rolls without slipping on the herpolhode lying in the
invariable plane." -- Goldstein, Classical Mechanics 2nd. ed., p207.
.
- Follow-Ups:
- Re: Lahman, how ya doing?
- From: Andrew McDonagh
- Re: Lahman, how ya doing?
- References:
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Re: Lahman, how ya doing?
- From: Gregory L. Hansen
- Re: Lahman, how ya doing?
- From: Andrew McDonagh
- Re: Lahman, how ya doing?
- Prev by Date: Help! Difficulty understanding DB -> Object mapping
- Next by Date: Re: Help! Difficulty understanding DB -> Object mapping
- Previous by thread: Re: Lahman, how ya doing?
- Next by thread: Re: Lahman, how ya doing?
- Index(es):
Relevant Pages
|