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 ctors
On Thu, 05 Aug 2010 13:53:20 -0400, dcoder 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 deriv
dcoder 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 'inherit' all or some
Steven Schveighoffer Wrote:
> On Thu, 05 Aug 2010 13:53:20 -0400, dcoder 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) {
Sean Kelly wrote:
> Steven Schveighoffer Wrote:
>
>> On Thu, 05 Aug 2010 13:53:20 -0400, dcoder 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 fol
On Fri, Aug 6, 2010 at 11:43, Rory Mcguire 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() {
>foreach (m; __traits(
Philippe Sigaud:
> This is my new once-a-day bug :(
Add them all to Bugzilla :-)
Bye,
bearophile
On Fri, Aug 6, 2010 at 19:09, bearophile 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 don't
what to believe
Philippe Sigaud wrote:
> On Fri, Aug 6, 2010 at 11:43, Rory Mcguire
> 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.
>>
>>
>
>>
Rory Mcguire wrote:
> Philippe Sigaud wrote:
>
>> On Fri, Aug 6, 2010 at 11:43, Rory Mcguire
>> 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
dcoder 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 'inherit'
On Fri, Aug 6, 2010 at 21:59, Rory Mcguire 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 typeof(this)
That way, there is no need for the user to provi
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 cl
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;
}
}
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
Philippe Sigaud wrote:
> On Fri, Aug 6, 2010 at 21:59, Rory Mcguire
> 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 typeof(this)
> That
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]
Thanks for suggestion
Andrej Mitrovic wrote:
> Here's an example:
[snip]
18 matches
Mail list logo