data classes and abstraction

This is a discussion on data classes and abstraction within the C++ Programming forums, part of the General Programming Boards category; i have doubts regarding the use of classes.please explain to me with an example....

  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, 10:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21