It's a waste of space, but here you go (this is in C++):
#include <iostream>
using namespace std;
class Number
{
private:
int num;
// this is a constructor - it's executed as soon as the class is created.
Number ()
{
num = 0;
}
// this is a destructor - it's executed when the class is destroyed.
~Number ()
{
}
public:
int getNum ()
{
return num;
}
void setNum (int newNum)
{
num = newNum;
}
void printNum ()
{
cout << num << endl;
}
void incrementNum ()
{
num++;
}
}
int main ()
{
Number num; // this creates a new instance of the class called "num"
while (num.getNum() <= 10)
{
num.incrementNum();
num.printNum();
}
return 0;
} NB: this is untested. Enjoy!