Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Get/Set Properties - Beginner VC++ 5

Get/Set Properties - Beginner VC++ 5

Get/Set Properties - Beginner VC++ 5

I am extremely new to VC++ 5. I have much experience in VB5, and I have a question regarding the two.

In Visual C++ 5, how do you access the nondefault poperties of an object? I know that you can set a control variable for default fields and use UpdateData.

I would appreciate any help, as I am very new to C++.

RE: Get/Set Properties - Beginner VC++ 5

Dear Huntjr,

C++ object have three scopes of attributes.
1) public
2) protected
3) private

The scope applies to every attribute, member variables and functions (methods) alike.

According to the most widely prescribed tenants of OOP no member variables should be given 'public' scope. Any object that is developed to this stringent standard would only provide access to data members through public member functions.

class foo{
  CString _name;
  foo(){} // constructor
  virtual ~foo(){} // destructor

  // public accessor functions
  void setname( CString name){ _name = name; }
  void setTheName( CString name) { _name = name; }
  void makesNoSense( CString name) { _name = name; }

  const CString& getname(){ return _name; }
  const CString& whatever() { return _name; }

As you can see by my example there is no 'standard' function for setting / getting data member variable values in C++. The developer can name functions(methods) and member variables anything he/she likes.

You really need to get some beginner C++ material to work with. The standard Visual C++ documentation will not help much in learning C++ techniques and Object Oriented Programming.

Hope this helps

RE: Get/Set Properties - Beginner VC++ 5

Thanks a bunch for your help, pete. I'm using a Teach Yourself in 21 Days books. I've learned pretty good with books; hopefully it will be same with VC++.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close