One type of function was left out of Unity Function Performance: virtual functions. Functions in C# are non-virtual by default and you have to explicitly use the virtual
and override
keywords to override them. Why not make this the default, like in AS3 or Java? Are virtual functions that much slower? Today’s article finds out! Should you be worried every time you make a function virtual
?
Posts Tagged virtual function
Today’s article continues from the last two in discussing features of C# classes that AS3 doesn’t have. We’ll discuss extension methods and the virtual function system that trips up so many C# newcomers.
Continuing from last time, this article begins covering features of C# classes that aren’t in AS3. We’ll begin with abstract classes and functions, which AS3 required workaround code to enforce even at run-time. Today’s article shows you how to use C# to cleanly enforce these at compile-time.