group.cpp

来自「ssd5 exercise2,敬请参考,hehe」· C++ 代码 · 共 42 行

CPP
42
字号
/*
*  Author: Ma Yaowen
*  version:1.0.0
*/
#include "Group.h"

//This returns the Client pointer whose object's email equals the parameter email. 
Client * Group::operator[](const string& email){
  
	Client* p;

	for(int i=0;i<objects.size();i++){
	   p=objects[i];

	   if(p->getEmail()==email){
	    return p;
	   }
	}

	return NULL;

}

//Adds the Client pointer given by the parameter to the vector objects. 
void Group::add(Client* ptr){

  objects.push_back(ptr);

}

//This returns an iterator to the first Client* in vector objects.
Group::iterator Group::begin(){
 
	return objects.begin();
}

//This returns an iterator to the last Client* in vector objects. 
Group::iterator Group::end(){

    return objects.end();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?