comp.lang.ada
 help / color / mirror / Atom feed
* Constructing by classwide type
@ 2017-04-03  1:04 sbelmont700
  2017-04-18 17:37 ` Alejandro R. Mosteo
  0 siblings, 1 reply; 5+ messages in thread
From: sbelmont700 @ 2017-04-03  1:04 UTC (permalink / raw)


Can anyone offer advice on the pros and cons of having constructor functions of extended types return their classwide parent in lieu of the concrete type?  Occasionally I find myself with an abstract parent type that is implemented by a broad number of children, none of which add any new primitive operations or are extended any further, and all of which are intended to be used in the context of their (classwide) parent; in these cases, there seems to be several marginal benefits to returning the parent type, including that nearly all declarations can be put into the body, it forces initialization, the constructor doesn't become a primitive operation, it acts as a kind poor mans 'final' keyword, et al...

None of it is earth-shattering, but apart from not having access to the underlying type (not necessarily a bad thing depending on circumstance), are there other downsides I've yet to discover?

Thanks for any advice

-sb

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

end of thread, other threads:[~2017-04-19 20:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03  1:04 Constructing by classwide type sbelmont700
2017-04-18 17:37 ` Alejandro R. Mosteo
2017-04-18 18:57   ` Randy Brukardt
2017-04-18 19:45     ` Dmitry A. Kazakov
2017-04-19 20:45       ` Randy Brukardt

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