Jelajahi Sumber

完成职工类并测试

Creamo 2 tahun lalu
induk
melakukan
040f8079e7
5 mengubah file dengan 72 tambahan dan 0 penghapusan
  1. 23 0
      employee.cpp
  2. 19 0
      employee.h
  3. 22 0
      worker.h
  4. 2 0
      职工管理系统.vcxproj
  5. 6 0
      职工管理系统.vcxproj.filters

+ 23 - 0
employee.cpp

@@ -0,0 +1,23 @@
+#include "employee.h"
+
+
+
+//构造函数
+Employee::Employee()
+{
+
+}
+
+
+//显示个人信息
+void Employee::showInfo()
+{
+
+}
+
+//获取岗位名称
+std::string Employee::getDeptName()
+{
+
+}
+ 

+ 19 - 0
employee.h

@@ -0,0 +1,19 @@
+//普通员工
+#pragma once
+#include <iostream>
+#include "worker.h"
+
+class Employee : public Worker
+{
+	//构造函数
+	Employee(int id, std::string name ,int dept_id);
+
+
+	//显示个人信息
+	virtual void showInfo();                      //virtual 关键字可删可不删
+
+	//获取岗位名称
+	virtual std::string getDeptName();            //virtual 关键字可删可不删
+
+
+};

+ 22 - 0
worker.h

@@ -3,3 +3,25 @@
 #include <string>
 
 
+//职工的抽象类
+class Worker
+{
+public:
+
+	//显示个人信息
+	virtual void showInfo() = 0;
+
+	//获取岗位名称
+	virtual std::string getDeptName() = 0;
+
+	//职工编号
+	int m_ID;
+
+	//职工姓名
+	std::string m_Name;
+
+	//部门编号
+	int m_DeptID;
+
+
+};

+ 2 - 0
职工管理系统.vcxproj

@@ -140,10 +140,12 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="1、WorkerMangerRequire.cpp" />
+    <ClCompile Include="employee.cpp" />
     <ClCompile Include="workerManger.cpp" />
     <ClCompile Include="职工管理系统.cpp" />
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="employee.h" />
     <ClInclude Include="worker.h" />
     <ClInclude Include="workerManger.h" />
   </ItemGroup>

+ 6 - 0
职工管理系统.vcxproj.filters

@@ -24,6 +24,9 @@
     <ClCompile Include="职工管理系统.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="employee.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="workerManger.h">
@@ -32,5 +35,8 @@
     <ClInclude Include="worker.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="employee.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>