CodePudding user response:
Don't know your specific requirements, just write the structure of a class, I hope it can help you,Note: the code can run directly, logic and content to redefine myself,
public class base_employee
{
Public base_employee ()
{}
//name
Private string _name=string. The Empty;
///& lt; Summary>
///name
///& lt;/summary>
Public string Name {get=& gt; _name; The set=& gt; _name=value; }
//gender
Private int _sex=1;
///& lt; Summary>
///gender
///& lt;/summary>
Public int Sex {get=& gt; _sex; The set=& gt; _sex=value; }
//to add
Private string _xxxx=string. The Empty;
Public string Xxxx {get=& gt; _xxxx; The set=& gt; _xxxx=value; }
}
///& lt; Summary>
///employee
///& lt;/summary>
Public class employee: base_employee
{
Public employee ()
{}
Public bool order (parameters)
{
Bool result=false;
Processing logic
return result;
}
}
///& lt; Summary>
that///...///& lt;/summary>
Public class manager: base_employee
{
Public manager ()
{}
Public bool buckle in employee wages (parameters)
{
Bool result=false;
Processing logic
return result;
}
}
CodePudding user response:
I think you should first design database rather than writing class first! What do you think!CodePudding user response:
As 1 l give you ideas, you establish an employee class, and then ordinary staff is the basis function, and the manager just have one more wages (attributes, you can use inheritance,Here, of course, I still want to say, in fact you this design is unreasonable in properties, deduct wages is behavior does not belong to the attribute, you understand him as role authorization here are some more appropriate
CodePudding user response: