The default can be used as a property is very bad design.
Brian
zoujiaqing at gmail.com
Fri Jan 25 02:09:29 UTC 2019
OH NO !
sample code:
```D
import std.stdio;
struct Config
{
string test = "aaa";
string test2 = "bbb";
}
Config config()
{
Config conf;
return conf;
}
class Test
{
void func1()
{
string config;
string testConfig = config().test;
writeln(testConfig);
}
}
```
build error:
```shell
osx:test zoujiaqing$ dmd config.d
config.d(22): Error: function expected before (), not config of
type string
```
More information about the Digitalmars-d
mailing list