Force child class to override function of ancestor via parent

前端 未结 3 1197
死守一世寂寞
死守一世寂寞 2020-12-11 05:33

I am writing an algorithm which requires the user to create his own class which inherits from a class defined by me. However, the algorithm requires the user to override the

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-11 05:55

    This is what you're looking for. Since your class is abstract you can pretty much do this without any problem.

    public abstract override int GetHashCode();
    

    This despite of it derived from some other class, this makes your sub class must override this method.

提交回复
热议问题