The Var anonymous type is based on the type's determined type when the field is initialized, and then cannot be changed.
Methods for adding classes for other projects. In the VS Class View, right-click to add a reference to select the item to refer to, and then add a using in the class to use the
If you use the parent class to initialize the enemy, you cannot force the conversion of the type
Enemy enemy;
Enemy = new Boss (); Initializes a parent class with a subclass, constructed with subclasses, essentially a subclass type
So the method that can be coerced into subclasses to use subclasses
This means that the parent class wants to use subclasses, and 1 needs to initialize 2 with subclasses to subclass
Boss Boss = (boss) enemy;
Boss. Attack ();
——————————————————————————————————
A virtual method can be overridden in any derived class subclass by declaring a base class function as virtual.
Overriding a method with the override keyword in a derived class
classmybaseclass{
Public virtual string Virtualmethod () {
}
}
________________
Class myderived
Public Overider string Virtualmethod () {
When a subclass overrides a method of a parent class, it is an overridden method, regardless of where it is invoked.
When initialized with the parent class, or before the original override method
This and base functions are to prompt, this prompts for features that are available to the current and parent classes, and base can only invoke the characteristics of the parent class