29 Jun 2012 21:17
Inferred return types
Jacob Carlborg <doob <at> me.com>
2012-06-29 19:17:54 GMT
2012-06-29 19:17:54 GMT
I just noticed that the return type of a function can be inferred
without using a storage class:
<at> property foo ()
{
return "foo";
}
void main ()
{
string str = foo;
}
Is that supposed to work? The specification says:
"If it does not already have a storage class, use the auto storage class."
But <at> property is not a storage class. It seems I can put most of the
attributes there instead of <at> property, both those with and without a <at> .
Second, it seems it's not possible to override a method with an inferred
return type, as the example below shows:
class Foo
{
auto foo ()
{
return "Foo";
}
}
(Continue reading)
RSS Feed