|
-
August 26th, 2004, 10:38 PM
#1
Do i need a copy constructor?
Good day to all! i just have a question regarding copy constructor... i created some plain class which i just based from an example of CToken Class that never used a copy constructor... is copy constructor really required in a class? can anyone give me a good explaination about copy constructor when to be used or not... here is some of my class that i created:
#include "CFunctionsLib.h"
#include "VRS.h"
class CItem
{
public:
int GetItemAvailable(CString sItemCode);
CString GetItemName(CString sItemCode);
CString m_sInv_Type;
BOOL CheckItemExist(CString sItem);
void AddItem(CString sItemCode, int iNoItems);
BOOL DeductItem(int iNoItems);
BOOL GetItem();
CString m_sItemType, m_sItemCode,
m_sItemPrevCode, m_sItemCategory,
m_sUserID, m_sItemDatePurchased,
m_sItemTitle, m_sItemDirector, m_sItemStarArtist,
m_sItemFilmMaker, m_sRentMaxDate;
double dItemPurchased, dItemRentAmt,
dItemSalesAmt, dItemPenalty, dPriceDue;
int iRentDuration, iSalesDuration, iNoOfItems, iItemAvailable;
void Initialize();
void LoadItem();
CItem(); // Constructor
virtual ~CItem(); // Destructor
private:
CFunctionsLib cFuncs;
CVRSApp *pApp;
_RecordsetPtr pSet;
_CommandPtr pCmd;
CString sSelect;
};
This example is about the Item Object (could be anything like apple, VCD, etc...).
Sorry for being a dumb in C++... Thanks for any reply you made... More power!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|