dimanche 10 mai 2020

How do you implement polymorphism for functions that require different parameters for different derived classes?

I have two different derived classes with different type properties. I need a virtual function in base class to set those properties. Thus, this function requires different types of arguments in different derived classes.

Look at the red text

I tried to make a interface for property. But the problem is that the SetProp of Drived_1 can receive a parameter of type Prop_2.

The red part is changed

How can I solve this problem?

Aucun commentaire:

Enregistrer un commentaire