vendredi 2 mars 2018

How to make multiple classes contain the same static method name?

I created an IUserModel which has a couple methods that each subclass will implement.

I have two User type classes: CoordinateLeaderModel and CommunityMemberModel

Each object contains a static method called "createFromJson(...)" which is unique for each Model.

I was wondering if there is a way to put the static method higher up in the hierarchy so that if I create another User type like "AdminModel" I will remember to create a static "createFromJson()" method.

Is there a specific design pattern to achieve something like this?

Aucun commentaire:

Enregistrer un commentaire