I have a “base” class which contains following properties:
public virtual Vector3b SIZE { get { return new Vector3b(16, 16, 16); } }
public virtual Vector3b MAX
{
get { return new Vector3b(
(byte)(this.SIZE.X - 1),
(byte)(this.SIZE.Y - 1),
(byte)(this.SIZE.Z - 1));
}
}
Now, if I override SIZE property in my class which inherits from the base class, does MAX then calculate SIZE from base class or from inherited class ( or should it be just SIZE without this ) ?
EDIT: Forgot to mention, Vector3b is just basicly Vector3 but it uses bytes instead of floats.
MAXwill use the derived classSIZEif the runtime type ofthisreference is the derived type. It’s called dynamic dispatch of virtual methods and properties, based on the runtime type of the object.