class class_name {
public:
variable declarations;
function prototypes;
private
variable declarations;
function prototypes;
};
class BigNum {
public:
const int MAXSIZE=10;
void print() const ;
void read();
void add(bignum other);
int compare(bignum other);
...
private:
bool sign;
int length;
int digits[MAXSIZE];
};
BigNum a, b; // declare two instances of a bignum
a.read(); // read a value into a;
b.read(); // read a value into b;
if (0 == a.compare(b)) {
a.print();
cout << " = " ;
b.print();
cout << endl;
}
class BigNum {
public:
BigNum(); // default constructor, no arguments, set the value to 0
BigNum(int num); // second constructor, set the value to int
...
}
...
BigNum a, b; // initialize a and b to 0
BigNum c(-10); // initialize c to -10