comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Constructing by classwide type
Date: Sun, 2 Apr 2017 18:04:50 -0700 (PDT)
Date: 2017-04-02T18:04:50-07:00	[thread overview]
Message-ID: <93d2cfb3-1518-4d99-8075-e636e1f32b5d@googlegroups.com> (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

             reply	other threads:[~2017-04-03  1:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  1:04 sbelmont700 [this message]
2017-04-18 17:37 ` Constructing by classwide type 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
replies disabled

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