Protected Members in Class

Salih Dincer salihdb at hotmail.com
Fri Dec 24 11:29:31 UTC 2021


On Friday, 24 December 2021 at 10:26:37 UTC, apz28 wrote:
> https://dlang.org/spec/attribute.html#visibility_attributes
> #5

Okay, what about the 2nd question (super or this).
```d
import app, std.stdio;
void main()
{
   auto any = new Any("int");
   //any.get().writeln; /*
   assert(any.data == "int"); /* main.d(7): Error:
            no property `data` for type `app.Any`,
            did you mean `app.Any.data`? */

}

module app;

class Any
{
     protected string data;

     this(string data) { this.data = data;
     }

     @property get() { return data; }
}

```


More information about the Digitalmars-d-learn mailing list