How can I get the name of the parent class of some class using Reflection?
The parent() method is used to return all ancestor of the selected elements. Check if ancestor (parent) class exist then it returns the class name otherwise returns not exist.
Now how can i get fields of parent class in this case 'a'. You can use getField() with public fields. Otherwise, you need to loop through parent classes yourself.
You would need to add a property to your Production class and set it to point back at its parent, this doesn't exist by default. Show activity on this post. In the Production constructor you can assign this to a private field or a property. Then Production will always have access to is parent.
Like so:
typeof(Typ).BaseType.Name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With