[Issue 9066] Add constructor inheritance feature

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 5 10:05:19 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9066



--- Comment #10 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-10-05 09:59:19 PDT ---
(In reply to comment #9)
> (In reply to comment #8)
> 
> Your example wouldn't compile.
> You can't default construct a class that defines a non-default constructor even
> though we do have implicit constructor inheritance.

I'm not default-constructing a class in that example.

> The rule here is very simple, if you define a constructor none is inherited.

I see what you mean, that could work. Although I still want the ability to
explicitly re-introduce base-class constructors via some syntax. So in essence
we'll have:

-----
class A { this(int); this(double); }
class B : A { }  // implicitly inherits ctors (very useful for Exception)
-----

-----
class A { this(int); this(double); }
class B : A { this(string); }  // does *not* inherit ctors
-----

I also want:

-----
class A { this(int); this(double); }

// inherit the this(int) ctor
class B : A { this(string); alias super.this(int) this; }
-----

However these two features can be implemented separately, so maybe we should
split this up into two enhancement requests.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list