Thread: data classes and abstraction

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    1

    data classes and abstraction

    i have doubts regarding the use of classes.please explain to me with an example.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Code:
    class POSITION
    {
       public:
          POSITION();
          POSITION(int X, int Y);
          int GetX();
          int GetY();
          void SetX(int X);
          void SetY(int Y);
          void SetPosition(int X, int Y);
       private:
          int Xpos;
          int Ypos;
    };
    
    int main()
    {
       POSITION PlayerPosition(120, 450);
       POSITION EnemyPosition(200, 180);
       ...
       return 0;
    }
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Abstraction
    By Nereus in forum C++ Programming
    Replies: 5
    Last Post: 09-17-2007, 09:19 PM