Results 1 to 40 of 45

Thread: Saving and loading

Threaded View

  1. #25
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Saving and loading

    Exactly as grilkip says. I usually name my variables the same as their corresponding property with a "m_" prefix because it indicates the relationship between the two. You are the second person to make this mistake when adapting my code. Perhaps I will make the distinction clearer in future. If the similarity between the names confuses you at all you can certainly use a different naming convention to mine.

    Edit:
    The "m_" prefix is to indicate a member variable as opposed to a local one. This type of naming convention is nto so necessary these days as IntelliSense gives you that type of information on mouse-over. I still use this particular throwback because it is a convenient way to show that a variable is related to a property. If you aren't too familiar with properties, you may be wondering why they should be used at all instead of just making the variables themselves public. Properties do several things for the developer that variables do not. They can be declared read-only, so they can return a value without allowing it to be updated. They allow calculated values when getting and complex operations when setting. They also allow you to change the implementation of a property without changing the interface. They basically combine the good bits of variables and methods into a single entity.
    Last edited by jmcilhinney; Jun 9th, 2005 at 08:00 PM.

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