Can Overloading be switched off?
Posted: Tue Aug 08, 2017 6:58 am
Different times I have inserted errors using virtual methods and unintentionally writing parameters with different types compared to the basic object method.
The compiler treats this as an overloaded method. This is correct behavior, but it is not what I originally intended looking at the framework of classes we are using. When calling the method late bound a runtime error is happening. Also the original method is not overridden as I intended to do.
Overloading can be a nice feature, it only interferes sometimes with virtual method design.
What could be nice to have an additional compiler switch for the assembly to be able to choose using virtual without overloading or overloading without virtual methods - or having both knowing that parameters must be verified correctly.
Arne
The compiler treats this as an overloaded method. This is correct behavior, but it is not what I originally intended looking at the framework of classes we are using. When calling the method late bound a runtime error is happening. Also the original method is not overridden as I intended to do.
Overloading can be a nice feature, it only interferes sometimes with virtual method design.
What could be nice to have an additional compiler switch for the assembly to be able to choose using virtual without overloading or overloading without virtual methods - or having both knowing that parameters must be verified correctly.
Arne