Error: a nonstatic member reference must be relative to a specific object

Discussion in 'C Programming' started by Computerjunkie, Apr 6, 2012.

  1. Computerjunkie

    Computerjunkie

    Joined:
    Apr 6, 2012
    Messages:
    1
    Likes Received:
    0
    I'm getting this error on this line:
    critter.Play();

    In the Critter.h file the Play() function is as such:
    int critter:: Play()
    {
    system("cls");
    cout << "You play with your critter making it happier!" << endl;
    }


    And i declare Play() in the public: like this:
    int Play();

    How would i get rid of this error? Thanks.
     
    Computerjunkie, Apr 6, 2012
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ce
    Replies:
    1
    Views:
    3,175
  2. Jinesh

    Static/NONstatic error!!

    Jinesh, Jan 5, 2004, in forum: C++
    Replies:
    8
    Views:
    12,176
    Heinz Ozwirk
    Jan 6, 2004
  3. PengYu.UT@gmail.com
    Replies:
    2
    Views:
    839
    Mark P
    May 9, 2005
  4. Clay_Culver@yahoo.com
    Replies:
    3
    Views:
    705
    Clay_Culver@yahoo.com
    Nov 4, 2005
  5. The|Godfather
    Replies:
    7
    Views:
    4,395
    Miles Bader
    Oct 24, 2006
  6. fl
    Replies:
    12
    Views:
    1,040
    Salt_Peter
    Dec 31, 2007
  7. Jeffrey
    Replies:
    7
    Views:
    595
    James Kanze
    Sep 30, 2008
  8. A. Farber
    Replies:
    5
    Views:
    379
    A. Farber
    Aug 23, 2008
Loading...