Protected internal cho phép giấu member khỏi class objects/functions khác, trừ child class trong cùng application.
Ví dụ derived class object truy cập protected internal variable:
Ví dụ
using System;
class One { protected internal int a = 50; private int b; }
class Two : One {
public Two() { Console.WriteLine(this.a); }
}
class Demo {
static void Main() {
Two t = new Two();
// allowed vì derived class object
t.a = 20;
}
}
Kết quả
50