Results 1 to 7 of 7

Thread: Class Vez Module

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Class Vez Module

    Is there any difference between Module & Class other than the class used to store classes ???

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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.

  3. #3

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    umm does Modules support inheritence ???

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Nope.

  5. #5
    Lively Member
    Join Date
    Jan 2002
    Location
    Malaysia
    Posts
    64
    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.

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Agreed...C# doesn't support standard modules. They are not considered good OOP practice.

  7. #7
    Member
    Join Date
    Sep 2002
    Location
    California
    Posts
    52
    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
  •  



Click Here to Expand Forum to Full Width