Thread: help with calling this setter

  1. #1
    Registered User
    Join Date
    Apr 2004

    Unhappy help with calling this setter

    void set_owner(string new_owner){owner = new_owner;}

    can someone tell me how to call this setter from main?? i wrote this, and i believe i wrote it correctly, but cannot call it...

    im trying to access owner from main, owner is a private member of a class....

    any help would be great, im stumped

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    The set_owner needs to be a member function of that class
    And you need to indicate when you call it which class object you're going to be using

    myclass myobj;
    myobj.set_owner( "me" );
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack issues when calling a COM library
    By notnot in forum C Programming
    Replies: 3
    Last Post: 06-01-2009, 02:12 AM
  2. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  3. calling default instead of argument constructor, why?!
    By cppn00b in forum C++ Programming
    Replies: 6
    Last Post: 01-30-2005, 04:24 AM
  4. calling conventions
    By Micko in forum C Programming
    Replies: 2
    Last Post: 07-18-2004, 09:13 AM
  5. Question on function syntax and calling function
    By cbrman in forum C Programming
    Replies: 10
    Last Post: 10-05-2003, 05:32 PM