C++ - class issue

前端 未结 6 1625
灰色年华
灰色年华 2021-01-24 19:33

At: http://www.learncpp.com/cpp-tutorial/82-classes-and-class-members/

There is the following program (I made some small modifications):

#include 

        
6条回答
  •  北恋
    北恋 (楼主)
    2021-01-24 20:00

    1.

    strncpy(m_strName,strName,25);
    

    You need to #include (where strncpy is declared).

    2.

    std::cout<<"Name: "<

    should be

    std::cout<<"Name: "<

    3.

    void setInfo(char *strName,int id,double wage)
    

    can be set to

    void setInfo(const char *strName,int id,double wage)
    

    to get rid of the g++ 4.x.x warning.

提交回复
热议问题