|
-
Nov 30th, 2002, 12:12 PM
#1
Thread Starter
Sleep mode
Class Vez Module
Is there any difference between Module & Class other than the class used to store classes ???
-
Nov 30th, 2002, 05:48 PM
#2
PowerPoster
Well, you can instantiate an object from a class. All a module is when it boils down to the IL code is a class with a private constructor that exposes static (shared) members.
-
Nov 30th, 2002, 08:44 PM
#3
Thread Starter
Sleep mode
umm does Modules support inheritence ???
-
Nov 30th, 2002, 10:30 PM
#4
PowerPoster
-
Dec 1st, 2002, 01:30 PM
#5
Lively Member
IMHO modules are just being kept there to keep legacy VB programmers happy.
Just use classes for your stuffs and declare your methods as shared methods. That way you don't have to instantiate an object everytime you want to use that method.
And with classes you get all the oop stuffs like inheritance that you don't get with modules.
I don't see any reason why anyone would still want to use modules other than to encourage spaghetti code.
-
Dec 1st, 2002, 02:45 PM
#6
PowerPoster
Agreed...C# doesn't support standard modules. They are not considered good OOP practice.
-
Dec 1st, 2002, 03:08 PM
#7
Member
Hmm.. there's only one real advantage to Modules and that's if you throw Subs, Functions, Properties etc in a Module you can use them without specifying the Modules name;
SomeModuleSub()
However in a class you obviously have to specify the class name first;
Class1.SomeClassSub()
Technically I suppose you could see Modules just as a use for helper methods that you'd normally throw in the same Class as the main application except putting it in a Module cleans up the code a bit. But of course so does putting the code inside a #Region so.
Take it as you will I suppose, but for the most part I'd have to agree with the posts above me.. Modules are more or less useless.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|