Calling an overridden function on the child class

My problem is exactly that: The variable is of type parent, not child. However, if I make of type childA, then I wont be able to store the ChildB, and viceversa

My question is on how can this be solved.