S
Shailesh Humbad
Here is my queue class. Is it okay to call a private member function
of the class from the constructor?
// custom constructor
MyQueue::MyQueue(unsigned long lInitialSize,
unsigned long lInitialSizeAlignment)
{
this->pbQueue = NULL;
this->InitializeClass(lInitialSize, lInitialSizeAlignment);
}
// default constructor
MyQueue::MyQueue()
{
this->pbQueue = NULL;
this->InitializeClass(DEFAULT_SIZE, DEFAULT_SIZE_ALIGNMENT);
}
// handles construction task
void
MyQueue::InitializeClass(unsigned long lInitialSize,
unsigned long lInitialSizeAlignment)
{
if(pbQueue != NULL)
{
return;
}
if(lInitialSize == 0)
{
lInitialSize = DEFAULT_SIZE;
}
if(lInitialSizeAlignment = 0)
{
lInitialSizeAlignment = DEFAULT_SIZE_ALIGNMENT;
}
this->pbQueue = (LPBYTE) HeapAlloc(hProcessHeap, HEAP_ZERO_MEMORY,
lInitialSize);
CheckAllocation(this->pbQueue, 1);
this->pbFront = this->pbQueue;
this->lQueueLength = 0;
this->lQueueMax = lInitialSize;
this->lSizeAlignment = lInitialSizeAlignment;
}
of the class from the constructor?
// custom constructor
MyQueue::MyQueue(unsigned long lInitialSize,
unsigned long lInitialSizeAlignment)
{
this->pbQueue = NULL;
this->InitializeClass(lInitialSize, lInitialSizeAlignment);
}
// default constructor
MyQueue::MyQueue()
{
this->pbQueue = NULL;
this->InitializeClass(DEFAULT_SIZE, DEFAULT_SIZE_ALIGNMENT);
}
// handles construction task
void
MyQueue::InitializeClass(unsigned long lInitialSize,
unsigned long lInitialSizeAlignment)
{
if(pbQueue != NULL)
{
return;
}
if(lInitialSize == 0)
{
lInitialSize = DEFAULT_SIZE;
}
if(lInitialSizeAlignment = 0)
{
lInitialSizeAlignment = DEFAULT_SIZE_ALIGNMENT;
}
this->pbQueue = (LPBYTE) HeapAlloc(hProcessHeap, HEAP_ZERO_MEMORY,
lInitialSize);
CheckAllocation(this->pbQueue, 1);
this->pbFront = this->pbQueue;
this->lQueueLength = 0;
this->lQueueMax = lInitialSize;
this->lSizeAlignment = lInitialSizeAlignment;
}