i know in c++, inheritance is either "public" or "private" or "protected" that meas if i inherit class A publicly to class B as follows
class A
{
public int pub1;
private int prvt1;
protected int proc1;
}
class B : public A
{
//public int pub1;//This variable is because of inheritacne and is internal.
//public int proc1;//This variable is because of inheritacne and is internal.
public int pub2;
private int prvt2;
protected int pro2;
}
i.e. two variables of class A, (pub1, proc1) got inherited but there access specifier is public. But in C# it is as follows
class A
{
public int pub1;
private int prvt1;
protected int proc1;
}
class B : A
{
//public int pub1; //This variable is because of inheritacne and is internal.
//protected int proc1;//This variable is because of inheritacne and is internal.
public int pub2;
private int prvt2;
protected int pro2;
}
i.e. two variables of class A, (pub1, proc1) got inherited but there access specifier is same as what was there in class A.
why is this kind of implementation given in .NET framework. what are the pros and cons in this?