Home > Back-end >  Please help me have a look at how the three mistakes change
Please help me have a look at how the three mistakes change

Time:09-24

Design one for the personnel management of people (staff), considering the universality, abstracts the properties of all types of workers are here: number (number), sex (sex), birthday (date of birth), id (id number), etc., the "date of birth", defined as embedded object member function is used to implement the personnel information input and display, requirements including: constructor, destructor, copy constructor, inline member functions, combination

CodePudding user response:

(1) the error C2512: 'Birthday' : no appropriate default constructor available
(2) the error C2228: left of 'setpeople' must have a class/struct/union type
(3) the error C2228: left of 'showpeople' must have a class/struct/union type

CodePudding user response:

(2) the error C2228: left of 'setpeople' must have a class/struct/union type
(3) the error C2228: left of 'showpeople' must have a class/struct/union type
People People ();//note that this is not declaring variables, the statement is the function prototype, good compiler such as v will remind you:
Warning C4930: "People People (void)" : not call prototype function (whether intentionally with variable definitions?)
People People;//this is variable, but you don't have a default constructor
People People (0,0,0,0,0,0);//this is the

(1) the error C2512: 'Birthday' : no appropriate default constructor available
Don't know what is your compiler, you will write a default constructor, Birthday to try again

CodePudding user response:

refer to the second floor GKatHere response:
(2) the error C2228: left of 'setpeople' must have a class/struct/union type
(3) the error C2228: left of 'showpeople' must have a class/struct/union type
People People ();//note that this is not declaring variables, the statement is the function prototype, good compiler such as v will remind you:
Warning C4930: "People People (void)" : not call prototype function (whether intentionally with variable definitions?)
People People;//this is variable, but you don't have a default constructor
People People (0,0,0,0,0,0);//this is the

(1) the error C2512: 'Birthday' : no appropriate default constructor available
Don't know what is your compiler, you will write a default constructor, Birthday try again

After added the default constructor is right, thank you
  • Related