VB.Net program to create an empty class

Here, we are going to learn how to create an empty class in VB.Net?
Submitted by Nidhi, on December 21, 2020 [Last updated : March 06, 2023]

Creating an empty class in VB.Net

Here, we will create a Sample class with an empty body.

Program/Source Code:

The source code to create an empty class is given below. The given program is compiled and executed successfully.

VB.Net code to create an empty class

'VB.Net program to create an empty class.

Class Sample
    
End Class

Module Module1
    Sub Main()
        Dim obj As New Sample

        Console.WriteLine("Type name: {0}", obj.GetType())
    End Sub
End Module

Output:

Type name: VbConsoleApp.Sample
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains the Main() function. Here we created a class Sample with an empty body.

The Main() function is the entry point for the program. Here, we created an object obj of class Sample and called GetType() method with an object that will print the name of the class on the console screen.

VB.Net Basic Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.