Marcus Kwok wrote:
2005 <uw*****@yahoo.comwrote:
There is a calss with
Class xxx{
public:
----
----
private:
bool Full () { return (............ true : false) ;}
};
I want to call/use the "Full" above in a the main or in a subroutine.
How do I go about?
Since Full() is private, you can only call it from within class xxx. If
you want to call it from outside of the class, you need to make
something a friend of class xxx.
Also, when posting code, please post real C++ code.
#define MAXSIZE 5
class CAlley {
public:
CAlley () : m_pTop(0), mSize(0), mMaxSize(MAXSIZE) { }
~CAlley () {}
int Park(int); // park a car
void Retrieve(int, CAlley *); // retrieve a car
void Terminate(); // quit the program
void Display(char *); // display contents af alley
private:
void SetTop(CarNode *p){m_pTop=p;} // assign top pointer
// check if stack is empty
bool Empty(){return ((mSize==0) ? true : false);}
// check if stack is full
bool Full() {return ((mSize==MAXSIZE) ? true : false);}
int Push(CarNode *); // push one node onto top of stack
// CarNode * Pop(); // pop one node from the top of stack
CarNode *m_pTop; // pointer to top of Allay (stack)
int mSize; // number of nodes in Allay (stack)
int mMaxSize; //max number of nodes in Allay (stack)
};
What should be the syntax to access the Fulleither in main and in
function?