comp.lang.ada
 help / color / mirror / Atom feed
* Setters and Getters - Classwide or Dispatching?
@ 2001-07-06 14:42 Anthony E. Glover
  2001-07-06 15:47 ` Ted Dennison
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony E. Glover @ 2001-07-06 14:42 UTC (permalink / raw)


What is the best approach for declaring setters and getters for a class -
classwide or primitive subprograms. Classwide would seem to be the best
approach since in all likelihood no one would override the getting or
setting of an attribute; however, this means that the operation is not
inherited by subclasses and requires an additional 'with' and possible 'use'
of the base class in order for the operation to be visible. Any suggestions?

Also, is there any way to call a dispatching subprogram without adding withs
and uses for all of the packages containing the subclasses. I'm refering to
a call that is not part of the parent.child hiearchy.

Thanks,
Tony






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Setters and Getters - Classwide or Dispatching?
  2001-07-06 14:42 Setters and Getters - Classwide or Dispatching? Anthony E. Glover
@ 2001-07-06 15:47 ` Ted Dennison
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Dennison @ 2001-07-06 15:47 UTC (permalink / raw)


In article <I3k17.11641$F%5.755714@e420r-atl2.usenetserver.com>, Anthony E.
Glover says...
>
>What is the best approach for declaring setters and getters for a class -
>classwide or primitive subprograms. Classwide would seem to be the best
>approach since in all likelihood no one would override the getting or
>setting of an attribute; however, this means that the operation is not
>inherited by subclasses

It means it isn't overridable with a dispatching subprogram. You can still use
it for any subclass.

> and requires an additional 'with' and possible 'use'
>of the base class in order for the operation to be visible. Any suggestions?

One common approach is to put "child" classes in child packages. That way the
"with" and "use" are implicit.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-06 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-06 14:42 Setters and Getters - Classwide or Dispatching? Anthony E. Glover
2001-07-06 15:47 ` Ted Dennison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox