0
so a protected member of a base class remains to be protected in a derived class and can therefore be derived again, if i understand this one correctly?
6 ответов
+ 2
Yes, that is correct. For example, the following code will work:
using System;
class A {
protected int x=42;
}
class B : A {
}
class C : B {
public C() {
//Access the protected member
Console.WriteLine(this.x);
}
}
class Program {
static void Main() {
C c = new C();
//Outputs 42
}
}
0
Yes that's correct.
0
u can use protected class in other class by determine inheritance "class form : prclass" and u can use protected member in new class this have a diferent with private method
0
Yes, you are right
0
Yes you are correct, but can be inherited by another class
0
what is the difference between sealed and private