G
Guest
Hi all
I have a class Parent, and two child classes class Child1
and class Child2 derived from Parent class.
In Parent class there is a method that will instantiate
child classes based on the input parameters it received.
I am able to instantiate my child class from the Parent
class, but not able to call the child class methods from
the Parent class by doing this.
Child1 ch1 = new Child1();
ch1.SomeMethod();
I think by changing the access level of SomeMethod() to
something like internal, I will be able to call the child
method from the parent class. But, I need to know if this
is the right way to do? Does it violate any OOP
recommendations? or can you recommend some other best
pratice? Thanks a lot for your help.
I have a class Parent, and two child classes class Child1
and class Child2 derived from Parent class.
In Parent class there is a method that will instantiate
child classes based on the input parameters it received.
I am able to instantiate my child class from the Parent
class, but not able to call the child class methods from
the Parent class by doing this.
Child1 ch1 = new Child1();
ch1.SomeMethod();
I think by changing the access level of SomeMethod() to
something like internal, I will be able to call the child
method from the parent class. But, I need to know if this
is the right way to do? Does it violate any OOP
recommendations? or can you recommend some other best
pratice? Thanks a lot for your help.