Employee
不知道 specialField
, , 只要 OtherEmployee
做。您需要将其投放到合适的课程中才能使用 specialField
.
Employee otherEmployee = new OtherEmployee();
这不会给你一个 OtherEmployee
但是 Employee
. 。能够使用 specialField
做这样的事情:
(otherEmployee as OtherEmployee).specialField = yourValue;