is there any reason UFCS can't be used with 'new'?

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 10 11:07:38 PST 2014


I can't understand how to use UFCS with instance of class:

void main()
{

string name = "Suliman";
userName username = new userName(name);

/// How to use UFCS here?
userName.name.sayHello();
///
}

class userName
{
     string name;

     this(string name)
     {
         this.name = name;
     }

     void sayHello(string name)
     {
         writeln(name);
     }
}


More information about the Digitalmars-d-learn mailing list