23
1
using System;
2
namespace AccessSpecifiers
3
{
4
class ProtectedTest
5
{
6
protected string name = "Shashikant";
7
protected void Msg(string msg)
8
{
9
Console.WriteLine("Hello " + msg);
10
}
11
}
12
public class Program
13
{
14
public static void Main(string[] args)
15
{
16
ProtectedTest protectedTest = new ProtectedTest();
17
// Accessing protected variable
18
Console.WriteLine("Hello "+ protectedTest.name);
19
// Accessing protected function
20
protectedTest.Msg("Swami Ayyer");
21
}
22
}
23
}
Cached Result
Allocated: 0 bytes per 'await using'