Polymorphic copy: Difference between revisions

Updated D entry
(added swift)
(Updated D entry)
Line 535:
 
override string toString() {
return "I'm the instance of S p: " ~ cast(string)str.idup;
}
 
Line 556:
orig.custom('Y');
 
writeln(orig).writeln;
writeln(copy).writeln; // Should have 'X' at the beginning.
}</lang>
{{out}}