Naming methods from strings using mixin

Robert Rouse robert.e.rouse at gmail.com
Tue Feb 21 10:44:07 PST 2012


Nevermind.. I had it as struct playing around and didn't change 
it back

On Tuesday, 21 February 2012 at 18:37:02 UTC, Robert Rouse wrote:
> I did not.
>
> Trying to new it gives me a compile error since "MyClass a" is 
> not a pointer.
>
> If I define another method without mixin and call it before the 
> "mixin" one, it works.
>
>
> On Tuesday, 21 February 2012 at 18:13:30 UTC, Adam D. Ruppe 
> wrote:
>> On Tuesday, 21 February 2012 at 18:07:34 UTC, Robert Rouse 
>> wrote:
>>> What am I missing?
>>
>> Did you remember to new the class?
>>
>> class MyClass {}
>>
>> MyClass a; // a is null right now
>> a = new MyClass(); // gotta remember this
>>
>>
>>
>> That's different than structs (or classes in C++)
>> which work without being new'd.




More information about the Digitalmars-d-learn mailing list