Re: inheriting ctors?

2010-08-09 Thread Rory Mcguire
Philippe Sigaud wrote: On Fri, Aug 6, 2010 at 21:59, Rory Mcguire rjmcgu...@gm_no_ail.com wrote: Here is a possible solution to your problem: -Rory I believe you can get the type of A. Isn't it typeof(super) or std.traits.BaseClassesTuple!B[0] ? B in the latter case being

Re: inheriting ctors?

2010-08-09 Thread Rory Mcguire
I had been trying to use AutoImplement to make something before but it gave me weird errors. I'm going to try using it for implementing this when I get some time. Andrej Mitrovic wrote: Here's an example: [snip]

Re: inheriting ctors?

2010-08-07 Thread div0
On 06/08/2010 22:57, Andrej Mitrovic wrote: // Offtopic Template errors are so hard to grasp, most of the time it's best to just ignore them and take some logical steps to fix the errors. At least that's in my case true.. lol, that's true. I've been basing out c++ d template code for years

Re: inheriting ctors?

2010-08-06 Thread Philippe Sigaud
On Fri, Aug 6, 2010 at 11:43, Rory Mcguire rjmcgu...@gm_no_ail.com wrote: I've been trying to make a template for this but it seems that dmd still won't allow me to get the parameters of the constructors. dmd Seems to think that I'm trying to use it as a property. void main() {

Re: inheriting ctors?

2010-08-06 Thread Philippe Sigaud
On Fri, Aug 6, 2010 at 19:09, bearophile bearophileh...@lycos.com wrote: Philippe Sigaud: This is my new once-a-day bug :( Add them all to Bugzilla :-) I do, from time to time. But I'm never sure if it's a bug or not. It's related to The Great And Neverending Property Debate (tm). So I

Re: inheriting ctors?

2010-08-06 Thread Rory Mcguire
Philippe Sigaud wrote: On Fri, Aug 6, 2010 at 11:43, Rory Mcguire rjmcgu...@gm_no_ail.com wrote: I've been trying to make a template for this but it seems that dmd still won't allow me to get the parameters of the constructors. dmd Seems to think that I'm trying to use it as a property.

Re: inheriting ctors?

2010-08-06 Thread Rory Mcguire
Rory Mcguire wrote: Philippe Sigaud wrote: On Fri, Aug 6, 2010 at 11:43, Rory Mcguire rjmcgu...@gm_no_ail.com wrote: I've been trying to make a template for this but it seems that dmd still won't allow me to get the parameters of the constructors. dmd Seems to think that I'm trying

Re: inheriting ctors?

2010-08-06 Thread Andrej Mitrovic
There is an AutoImplement class template in http://www.digitalmars.com/d/2.0/phobos/std_typecons.html#AutoImplement , which I've just been trying out. Apparently you can pass it 1: a Base class, 2: a templated function to filter out which functions you want to inherit/overwrite from the Base

Re: inheriting ctors?

2010-08-06 Thread Andrej Mitrovic
Here's an example: import std.stdio; import std.traits; import std.conv; import std.typecons; class C { int m_value; int testMe() { return 1; } this(int x) { m_value = x; } this(int x, int z) { m_value = x + z; } }

inheriting ctors?

2010-08-05 Thread dcoder
Suppose I have a base class with many ctors(). I want to inherit from the base class and make one slight alteration to it, but I don't want to write X times the following: this(args) { super(args); } Does D have an easy way for the derived class to 'inherit' all or some of the base class

Re: inheriting ctors?

2010-08-05 Thread Steven Schveighoffer
On Thu, 05 Aug 2010 13:53:20 -0400, dcoder dco...@devnull.com wrote: Suppose I have a base class with many ctors(). I want to inherit from the base class and make one slight alteration to it, but I don't want to write X times the following: this(args) { super(args); } Does D have an

Re: inheriting ctors?

2010-08-05 Thread Simen kjaeraas
dcoder dco...@devnull.com wrote: Suppose I have a base class with many ctors(). I want to inherit from the base class and make one slight alteration to it, but I don't want to write X times the following: this(args) { super(args); } Does D have an easy way for the derived class to

Re: inheriting ctors?

2010-08-05 Thread Sean Kelly
Steven Schveighoffer Wrote: On Thu, 05 Aug 2010 13:53:20 -0400, dcoder dco...@devnull.com wrote: Suppose I have a base class with many ctors(). I want to inherit from the base class and make one slight alteration to it, but I don't want to write X times the following: