Protected Members in Class

Salih Dincer salihdb at
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?

// Source:
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 = "deneme";
}/* Console Out:
bu bir deneme--> Split:
["bu", "bir", "deneme"]

More information about the Digitalmars-d-learn mailing list