worker.h

来自「文件包含了很多VC实例」· C头文件 代码 · 共 59 行

H
59
字号
// student.h

#ifndef _H_STUDENT_
#define _H_STUDENT_
class CWorker : public CObject
{
    //DECLARE_DYNAMIC(CWorker)
	DECLARE_SERIAL(CWorker)
public:
    CString m_strName;
    int m_nMoney;
public:
	virtual void Serialize(CArchive& ar);
    
    CWorker()
    {
        m_nMoney = 0;
    }
    
    CWorker(const char* szName, int nGrade) : m_strName(szName)
    {
        m_nMoney = nGrade;
    }

    CWorker(const CWorker& s) : m_strName(s.m_strName)
    {
        // copy constructor
        m_nMoney = s.m_nMoney;
    }

    const CWorker& operator =(const CWorker& s)
    {
        m_strName = s.m_strName;
        m_nMoney = s.m_nMoney;
        return *this;
    }

    BOOL operator ==(const CWorker& s) const
    {
        if ((m_strName == s.m_strName) && (m_nMoney == s.m_nMoney)) {
            return TRUE;
        }
        else {
            return FALSE;
        }
    }

    BOOL operator !=(const CWorker& s) const
    {
        // Let's make use of the operator we just defined!
        return !(*this == s);
    }
#ifdef _DEBUG
    void Dump(CDumpContext& dc) const;
#endif // _DEBUG
};
typedef CTypedPtrList<CObList, CWorker*> CWorkerList;
#endif // _INSIDE_VISUAL_CPP_STUDENT

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?