> Similarly, C# does differentiate between a class and an instance of a class. Both a class and an instance are of a given type, but a class is not an instance of a class.
Incidentally one of the things I missed from Delphi in C#. In Delphi you can declare
type TWidgetClass = class of TWidget;
Then you can declare variables of TWidgetClass, and assign TWidget or any subclass to such variables, and call class methods using it, like say the constructor.
var widgetClass := TTextWidget;
var myWidget := widgetClass.Create();
After which myWidget holds and instance of TTextWidget. Very handy for factory pattern code, but also other stuff. Of course after C# got generics it alleviated some of this.
Incidentally one of the things I missed from Delphi in C#. In Delphi you can declare
Then you can declare variables of TWidgetClass, and assign TWidget or any subclass to such variables, and call class methods using it, like say the constructor. After which myWidget holds and instance of TTextWidget. Very handy for factory pattern code, but also other stuff. Of course after C# got generics it alleviated some of this.