Thread: Confused about classes

  1. #1
    Registered User
    Join Date
    Oct 2005

    Confused about classes

    I'm trying to learn Visual If you are creating a class that is going to have an array in it must you use get and set methods. Or is there a different way it should be handled. This is a console program.

    Thanks Augie

  2. #2
    Registered User
    Join Date
    Mar 2005
    using getters and setters is recommend. Infact, it's the de facto standard for most C# developers. getters and setters are pretty much like methods because their assembly is identical to one, but if it's a simple set and get, then they are inlined. You could use methods, but then that defeats the purpose of getters and setters, right? Methods, on the other hand are looked at as functions that "act" on the data in the same class it's in. They change the state of an object through the help of set's and get's.

    As for the array inside the class situation; I personally would probably use an indexer (get and set functionality).


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. College Classes
    By nubby in forum C Programming
    Replies: 2
    Last Post: 10-07-2007, 12:32 AM
  2. C++ Classes: Use, Misuse...Confusion.
    By Snorpy_Py in forum C++ Programming
    Replies: 4
    Last Post: 10-23-2006, 01:46 AM
  3. Classes being able to use other classes functions
    By rainmanddw in forum C++ Programming
    Replies: 6
    Last Post: 01-29-2006, 11:19 AM
  4. Classes with Other Classes as Member Data
    By njd in forum C++ Programming
    Replies: 2
    Last Post: 09-27-2005, 09:30 AM
  5. Sharing a variable between classes of different .CPP files
    By divingcrab in forum C++ Programming
    Replies: 5
    Last Post: 07-07-2002, 02:57 PM