Topic: Allowing constructor inheritance ?
Author: "Neil Macleod" <mail@futuristic.co.uk>
Date: 2000/01/20 Raw View
Andy Glew <glew@cs.wisc.edu> wrote in message
news:85gpa2$s3n@spool.cs.wisc.edu...
> > (There's no natural or intuitive way of squishing e.g. two non-default
> > constructors into one, even if they have the same function signature)
>
> Well, actually, keyword parameters would be such a way.
>
I'm having some difficulty understanding your meaning - the only definition
of 'keyword parameter' I can find
is that they '... correspond to arguments that are optional and may be given
in any order ...'.
If this is your meaning then yes, in theory I agree. This is pushing well
into the realms of new syntax though ?
--
Neil Macleod
mail@futuristic.co.uk
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: macleod_neil@my-deja.com
Date: 2000/01/10 Raw View
An open question (which I hope is on-topic !)
Although it is not currently a feature of C++, can anyone see any
theoretical objection to a language relaxation allowing the inheritance
of constructors/assignment operators by derived classes that do not
define any member variables, and have no virtual methods ?
Whether this could be achieved implicitly or by an as-yet undefined
explicit syntax is not presumed.
Sent via Deja.com http://www.deja.com/
Before you buy.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Francis Glassborow <francis@robinton.demon.co.uk>
Date: 2000/01/11 Raw View
In article <85c8nq$p9u$1@nnrp1.deja.com>, macleod_neil@my-deja.com
writes
>An open question (which I hope is on-topic !)
>
>Although it is not currently a feature of C++, can anyone see any
>theoretical objection to a language relaxation allowing the inheritance
>of constructors/assignment operators by derived classes that do not
>define any member variables, and have no virtual methods ?
I can understand how this would be attractive, however it would need
some very thoughtful drafting as such things as virtual bases and
multiple inheritance would cause problems.
>
>Whether this could be achieved implicitly or by an as-yet undefined
>explicit syntax is not presumed.
Francis Glassborow Journal Editor, Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Neil Macleod" <mail@futuristic.co.uk>
Date: 2000/01/11 Raw View
Quite so. At least one problem that I can see is that a class could never
sensibly multiply inherit in such a way, directly (or indirectly) from more
than one parent (or ancestor) which defined either non-default constructors
or assignment operators, unless those constructors/operators were all
ultimately inherited from the same virtual base class - a fairly strong
restriction.
(There's no natural or intuitive way of squishing e.g. two non-default
constructors into one, even if they have the same function signature)
However, I believe that the compiler could perform static checks for the
'sensibleness' of such inheritance in various situations without recourse to
new syntax, working on the basis that if a constructor is always implicitly
defined if it's sensible.
Whether this is a good idea or not as regards programmer intuition is
another question.
Any comments gratefully received
--
Neil Macleod
mail@futuristic.co.uk
Francis Glassborow <francis@robinton.demon.co.uk> wrote in message
news:c+myjSAlBde4EwZS@robinton.demon.co.uk...
> In article <85c8nq$p9u$1@nnrp1.deja.com>, macleod_neil@my-deja.com
> writes
> >An open question (which I hope is on-topic !)
> >
> >Although it is not currently a feature of C++, can anyone see any
> >theoretical objection to a language relaxation allowing the inheritance
> >of constructors/assignment operators by derived classes that do not
> >define any member variables, and have no virtual methods ?
>
> I can understand how this would be attractive, however it would need
> some very thoughtful drafting as such things as virtual bases and
> multiple inheritance would cause problems.
>
>
> >
> >Whether this could be achieved implicitly or by an as-yet undefined
> >explicit syntax is not presumed.
>
> Francis Glassborow Journal Editor, Association of C & C++ Users
> 64 Southfield Rd
> Oxford OX4 1PA +44(0)1865 246490
> All opinions are mine and do not represent those of any organisation
>
> ---
> [ comp.std.c++ is moderated. To submit articles, try just posting with ]
> [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
> [ --- Please see the FAQ before posting. --- ]
> [ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
>
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Andy Glew" <glew@cs.wisc.edu>
Date: 2000/01/13 Raw View
> (There's no natural or intuitive way of squishing e.g. two non-default
> constructors into one, even if they have the same function signature)
Well, actually, keyword parameters would be such a way.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]