Arcane_Disciple
02-23-2003, 02:13 PM
*Note: I am not asking for exact code for the second part of my question. I want a plain english explaination.
Here is my header:
class intEntry
{
public:
intEntry(int v, int c = 1);
// initializes the integer value and its count
int getValue() const; //return value
void increment(); //increment count
friend bool operator< (const intEntry& lhs,const intEntry& rhs);
friend bool operator== (const intEntry& lhs,const intEntry& rhs);
//compare lhs and rhs using value
friend ostream& operator<< (ostream& ostr, const intEntry& obj);
//output obj in format
//"value value ... value" (count times)
private:
int value; //integer value
int count; //number of occurrences of value
};
intEntry::intEntry(int,int)
{};
//*************************
int intEntry::getValue() const
{
return value;
};
//*************************
void intEntry::increment()
{
count++;
};
//*************************
Question One: How do you add the the bool lines to my class structure? (This is the only part I ask for exact code. This is a very general thing.
Question Two: How does a bool setup print something? From what I have been taught, bool is used to test true or false.
Thanks.
Here is my header:
class intEntry
{
public:
intEntry(int v, int c = 1);
// initializes the integer value and its count
int getValue() const; //return value
void increment(); //increment count
friend bool operator< (const intEntry& lhs,const intEntry& rhs);
friend bool operator== (const intEntry& lhs,const intEntry& rhs);
//compare lhs and rhs using value
friend ostream& operator<< (ostream& ostr, const intEntry& obj);
//output obj in format
//"value value ... value" (count times)
private:
int value; //integer value
int count; //number of occurrences of value
};
intEntry::intEntry(int,int)
{};
//*************************
int intEntry::getValue() const
{
return value;
};
//*************************
void intEntry::increment()
{
count++;
};
//*************************
Question One: How do you add the the bool lines to my class structure? (This is the only part I ask for exact code. This is a very general thing.
Question Two: How does a bool setup print something? From what I have been taught, bool is used to test true or false.
Thanks.