Error: function declaration without return type.

Martin DraĊĦar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 6 13:44:51 PST 2015


Dne 6.1.2015 v 22:25 Suliman via Digitalmars-d-learn napsal(a):
> On Tuesday, 6 January 2015 at 21:19:38 UTC, bearophile wrote:
>> Suliman:
>>
>>>     void foo()
>>>     {
>>>     writeln("test");
>>>     writeln(mystring);
>>>     }
>>>     foo();   <<<<<
>>> }
>>
>> I guess you have to remove that line.
>>
>> Bye,
>> bearophile
> 
> Why? I can't call function in instance of class?

What would that even mean? When would the function ran? If you want to
call that function during instantiation, put it into constructor. If you
want to call it sometime later, than you have to call it from somewhere
else. But having a function call inside a class does not compute...

Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3279 bytes
Desc: Elektronicky podpis S/MIME
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150106/3ba229a4/attachment.bin>


More information about the Digitalmars-d-learn mailing list