Home >>VB.Net Built-in Functions >VB.Net program to create an empty class

VB.Net program to create an empty class

Write a VB.Net program to create an empty class

Here, a sample class will be created with an empty body.

Program :

Below is the source code for creating an empty class. The program given is compiled and successfully executed.

'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
Explanation:

We created a Module1 module in the program above that includes the Main() function. We built a sample class here, with an empty body.

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


No Sidebar ads