What is the difference between “instantiated” and “initialized”?

后端 未结 11 2246
青春惊慌失措
青春惊慌失措 2020-11-30 17:02

I\'ve been hearing these two words used in Microsoft tutorials for VB.NET. What is the difference between these two words when used in reference to variables?

11条回答
  •  时光取名叫无心
    2020-11-30 17:36

    Instantiation refers to the allocation of memory to create an instance of a class whereas initialization refers to naming that instance by assigning the variable name to that instance.

    Eg: SqlConnection conn = new SqlConnection();

    Here new is a keyword which allocates memory for an instance and conn is a variable name assigned for that instance.

提交回复
热议问题