What is the difference between a class and a module in Visual Basic?

1 Answers
Answered by suresh

Difference Between Class and Module in Visual Basic

What is the difference between a class and a module in Visual Basic?

In Visual Basic, a class is a blueprint for creating objects. It defines the properties, methods, and events that an object will have. Objects created from a class can have multiple instances, each with its own state and behavior.

On the other hand, a module in Visual Basic is a container for code that can hold variables, functions, and subroutines. Modules are used for organizing code that does not require an instance to be created. They are essentially a collection of related procedures and data that can be accessed globally throughout the program.

So, the main difference between a class and a module in Visual Basic is that a class is used to create objects with state and behavior, while a module is used for organizing code that does not require instantiation.

Answer for Question: What is the difference between a class and a module in Visual Basic?