If the parent class has an internal class,
I would like to know how to read and write the properties of the internal class from the inheritance destination.
public class MainClass:ClassA{
ClassAa = new ClassA();
a. AAA = "OK";
// a.classB.BBB??// ← I want to read and write this, but I can't access it
}
public class ClassA {
public string AAA {get;set;}
public class ClassB{
public string BBB {get;set;}
}
}
Thank you for your cooperation.
c#
Instancing ClassA does not mean that ClassB is instantiated.
To use it like the code presented, you must instantiate and publish ClassB as soon as ClassA is instantiated.
public class ClassA
{
public string AAA {get;set;}
publicClassBclassB{get;} = newClassB();
public class ClassB
{
public string BBB {get;set;}
}
}
© 2024 OneMinuteCode. All rights reserved.