Home >>VB.Net Built-in Functions >VB.Net program to demonstrate the 'MyClass' keyword
Here, the MyClass keyword will be demonstrate. To refer to the existing class name, the MyClass keyword is used.
Program :Below is the source code to demonstrate the MyClass keyword. The program given is compiled and successfully executed.
'VB.net program to demonstrate the "MyClass" keyword.
Module Module1
Class Sample
Sub Fun1()
Console.WriteLine("Fun1() called")
End Sub
Sub Fun2()
MyClass.Fun1()
Console.WriteLine("Fun2() called")
End Sub
End Class
Sub Main()
Dim obj As New Sample()
obj.Fun2()
End Sub
End Module
We created a Module1 module in the above program that contains a Sample Class. In the Sample class, we developed the three fun1() and fun2() method. Here, we used the MyClass keyword to call the fun1() method within the fun2() method.
Finally, the Main() method was developed, and the Main() method is the program's entry point. Here, we created the Sample Class object and then called the fun2() method to call the fun1() method and print the console screen messages.