Register | Login 
Forum  
SearchForum Home
     
  Study Groups  VB.NET Key Points  Ch 6 - Class Fu...
 Ch 6 - Class Fundamentals
 
 3/19/2006 11:41:42 PM
rcasebere
3 posts


Ch 6 - Class Fundamentals
1. Dim statements define private fields inside a class but public for strucures..
2. Methods may be overloaded via different parameter signatures.
3.Partial classes allow a class definition to span
modules.
4. Properties are more versatile than fields.
5. A method should be used in lieu of a write-only property.
 3/20/2006 9:46:19 PM
possum
2 posts


Re: Ch 6 - Class Fundamentals
1.  Method overloading allows you to perform the same task with different arguments and IntelliSense makes it super easy to figure out which method you want to use.
2.  Public properties should be used to keep fields private.
3.  You can throw exceptions from inside a constructor to ensure that valid arguments are passed.
4.  Shared members belong to the type and not to an instance of it.  It's not a good coding practice to access a shared member through an instance variable.
5.  You can bypass operator overloading by creating a shared method and call it something creative like "Add" or "Plus".
 3/20/2006 10:19:53 PM
DanTaylor
4 posts
Oriskany.net


Re: Ch 6 - Class Fundamentals
 Modified By DanTaylor  on 3/20/2006 10:21:15 PM)
  • Microsoft Reccomendation for Casing
       Do not Use Hungarian Casing ex. strVariable
       Use Pascal Casing for Variables ex: Variable Name
        Use Camel Case for Parameters ex. Public Sub Sub1(ByVal firstParameter as String)
  • Use a local variable instead of a public variable when need to repeatedly call the value of a public variable.
  • Array or Collection Type Properties should be exposed as readonly as their own methods will let you modify the array.
  • You can use a different scope for the Get or Set of a property than the Property itself.  This scope must be more restrictive thatn the property scope.
  • Factory Method VS Instance Constructor
      A Factory Method is a method that creates an object and returns it to the caller.  They are used when a type exposes a method that creates an instance of the type itself.
    When the Instance Constructor runs the opbject has already been created.(Memory Allocated)
        Factory Method can execute code before creating the object.(Memory has not been allocated yet)

  Study Groups  VB.NET Key Points  Ch 6 - Class Fu...

Copyright (c) 2008 GSP Developers
Walling Info Systems | Terms Of Use | Privacy Statement