com_clg_pre.h
来自「在本实例中,实现了单体模式,工厂模式,门面模式以及STL编程」· C头文件 代码 · 共 48 行
H
48 行
#pragma once
#ifndef COM_CLG_PRE_H
#define COM_CLG_PRE_H 1
#include "clg_pre.h"
#include "student.h"
#include"com_stu1.h"
#include<vector>
#include"string"
#include"iostream"
using namespace std;
class com_clg_pre:public clg_pre
{
public:
vector<CString> v_Student;
vector<CString>::iterator it;
static com_clg_pre *com_pre;
com_clg_pre()
{
this->name="xiaoli";
v_Student.push_back("2005101");
v_Student.push_back("2005102");
v_Student.push_back("2005103");
}
student* zhaodao(CString strid)
{
v_Student.rbegin();
for(it=v_Student.begin();it<v_Student.end();it++)
{
if(strid==*it)
{
return new com_stu(strid);;
}
}
return NULL;
}
static com_clg_pre* createpre()//利用单体模式,确立院长只可以有一个
{
if(com_pre==NULL)
{
com_pre=new com_clg_pre();
}
return com_pre;
}
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?