writeln an object

John Colvin john.loughran.colvin at gmail.com
Thu Apr 18 11:25:20 PDT 2013


On Thursday, 18 April 2013 at 18:04:03 UTC, Andrej Mitrovic wrote:
> On 4/18/13, gedaiu <szabobogdan at yahoo.com> wrote:
>> i've done that but i get this error:
>>
>> Error: function base.Value.Value.toString cannot override a
>> non-virtual function
>> Error: function base.Value.Value.toString override only applies
>> to class member functions
>>
>
> If it's a struct then don't put "override".

Just to provide a bit more info:

Classes all derive from Object, which defines toString. Hence, 
you need to override it to define your own.

Structs don't have a parent (or any inheritance at all) and hence 
you don't override anything, you just define the method.


More information about the Digitalmars-d-learn mailing list