Home > Net >  For bosses to solve
For bosses to solve

Time:09-20

Write an employee and a manager, employees have a rank, have basic salary, there are business of these features, there are order volume sum (do) and computational salary (basic salary + according to rank what percentage of commission) to set the traffic behavior, the manager in addition to having the features of employees, employee wages behavior and buckle

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:

reference 3 floor against the wall of the bat's reply:
I think you should first design database rather than writing class first! What do you think!


Now there are all sorts of orm, doesn't have to write the database, instead of writing class is popular.
  •  Tags:  
  • C#
  • Related