Syntax for virtual members

前端 未结 4 1900
孤街浪徒
孤街浪徒 2021-01-12 05:21

Consider the following class written in c# .net 4.0 (typically found in a nhibernate class):

public class CandidateEntity : EntityBase
{
    public virtual I         


        
4条回答
  •  执笔经年
    2021-01-12 06:23

    Create an overridable (virtual) method called OnInit or something similar and initialize Grade in there, then call OnInit from the constructor.

    The warning is there to inform you that you are creating a behavior that will be difficult for implementers to override.

提交回复
热议问题