❔ cast parent to child
Have a problem about inheritance.
I have an interface that are shared between a net framework project and net 6 project.
Some of methods are called by passing classA object.
My idea was to have classB inherits classA so that in the net framework project I can call the method by passing classA.
And in the Net 6 project I can cast classA to classB (parent to child).
classA is a class with only some enum and properties.
classB have some methods that uses libraries which might not be compatible in net framework.
However, I learnt from some places that parent to child is not allow
Where some places says it is possible by using as and is keyword.
I have an interface that are shared between a net framework project and net 6 project.
Some of methods are called by passing classA object.
My idea was to have classB inherits classA so that in the net framework project I can call the method by passing classA.
And in the Net 6 project I can cast classA to classB (parent to child).
classA is a class with only some enum and properties.
classB have some methods that uses libraries which might not be compatible in net framework.
However, I learnt from some places that parent to child is not allow
Where some places says it is possible by using as and is keyword.