C Sharp (C#) - Inheritance
Examine the code below and identify the issue:
class Parent {
protected int data = 100;
}
class Child : Parent {
void ShowData() {
Parent p = new Parent();
System.Console.WriteLine(p.data);
}
}Examine the code below and identify the issue:
class Parent {
protected int data = 100;
}
class Child : Parent {
void ShowData() {
Parent p = new Parent();
System.Console.WriteLine(p.data);
}
}15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions