• +91 9723535972
  • info@interviewmaterial.com

VB.Net Interview Questions and Answers

Question - Explain the usage of the NEW keyword with an example.

Answer -

The constructor is used along with the NEW keyword. Its usage can be as that of a modifier or an operator. The NEW keyword hides inherited members from base class members when used as a modifier. It produces objects for invoking constructors when used as an operator. The NEW keyword creates a new object instance, provides a constructor constraint on a type argument, or designates another function as a class constructor. A New clause can be used in either a declaration or an assignment statement. When you run the statement, it calls the proper constructor of the specified class, passing any parameters you have given it. 

An example of the usage of the NEW keyword is given below:

Dim teacher1 As New Teacher()

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners