Protected Members in Class
Salih Dincer
salihdb at hotmail.com
Fri Dec 24 08:35:38 UTC 2021
What do I need to do to see that the protected is active, need a
separate module?
```d
// Source: https://tour.dlang.org/tour/en/basics/classes
class Any
{
// protected is just seen by inheriting
// classes
protected string type;
this(string type) {
this.type = type;
}
// public is implicit by the way
string getType() {
return type;
}
}
import std.stdio, std.string;
import std.uni : isWhite;
void main()
{
Any any = new Any("bu bir deneme");
any.getType.writeln("--> Split:");
any.type.split!isWhite.writeln;
any.type = "deneme";
any.type.writeln;
}/* Console Out:
bu bir deneme--> Split:
["bu", "bir", "deneme"]
deneme
*/
```
More information about the Digitalmars-d-learn
mailing list