Public class CompanyName {public string CompanyName {get; set; }...} // Department public class Department {// Department id public int DepartmentId {get; set; } // DepartmentName public string DepartmentName {get; set; // Employee id public int EmployeeId {get; set; } // EmployeeName public string EmployeeName {get; set; }..}Copy the code

Department public class Department {// Department id public int DepartmentId {get; set; } // DepartmentName public string DepartmentName {get; set; Public class CaiWuDepartment: Department {public void AddNewEmployee(Employee e) {.... }}Copy the code

// Employee public class Employee {// Employee ID public int EmployeeId {get; set; } // EmployeeName public string EmployeeName {get; set; }} public class JIngLiEmployee: DataNode {public void TiqianXiaBan() {}Copy the code

Public abstract class DataNode {// Obtain the number of employees public abstract int GetEmployeeNumber(); } // Company public class Company: DataNode {// Company name public string CompanyName {get; set; }} // Department public class Department: DataNode {// Department id public int DepartmentId {get; set; } // DepartmentName public string DepartmentName {get; set; Public class CaiWuDepartment: Department {public void AddNewEmployee(Employee e) {//.... }} // Employee public class Employee: DataNode {// Employee ID public int EmployeeId {get; set; } // EmployeeName public string EmployeeName {get; set; }} public class JIngLiEmployee: DataNode {public void TiqianXiaBan() {}Copy the code

The above is just a class as an abstract demonstration, the real behavior abstraction or interface to abstract more appropriate, this is just a dish dish according to experience to sum up a little experience, if wrong, please comment correct

More interesting articles

  • Distributed large concurrent series
  • Architectural Design Series
  • Series of interesting algorithms and data structures
  • Design Pattern series