Hello. I have a question, is it possible to call the constructor of an object if you don’t know exactly what type it is? Several other classes are inherited from one base class. In the parameters of a certain function, I send an object that is inherited from the parent. In the method there is a check whether the object is null, if so, you need to create an object. I can determine the type of an object, but I have a problem with creating a constructor. Here is an example of the function:
public static void Open(Form form) { if (form==null) form = new Form();//Вместо этого определить тип(Form1, Form2, и т.д.) //и вызвать нужный конструктор ... }