Shadowing is a concept of altering the behaviour of the base class member. It basically replaces complete element of the parent class like method becomes a variable.
For example: In the below example in class1 'i' is declared as variable whereas in class2 'i' is declared as a method.
static void Main(string args)
class1 obj = new class1();
class2 obj1 = new class2();
obj1.i(); //here i is treated as method
Console.WriteLine(obj.i); //here i is treated as variable
public int i=2;
class class2 : class1
public void i()
In the following manner we can describe the C# access modifiers: -
Public - The members (Functions & Variables) declared as public can be accessed from anywhere.
Private - Private members cannot be accessed from outside the class. This is the default access specifier for a member, i.e if you do not specify an access specifier for a member
(variable or function), it will be considered as private. Therefore, string PhoneNumber; is equivalent to private string PhoneNumber;
Protected - Protected members can be accessed only from the child classes.
Internal - it can be accessed only within the same assembly.
Internal Protected - internal protected can be accessed within the same assembly as well as in derived class.