Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Member.h"
- #include <iostream>
- using namespace std;
- static int totcount=0;
- Member::Member(){
- this->followers=0;
- this->following=0;
- totcount++;
- this->id=totcount;
- }
- Member::~Member(){
- totcount--;
- this->following--;
- }
- void Member::follow(Member& m){
- if(&m != this){
- if(check(m.id)==false){
- this->following++;
- Listfoll[m.id] = &m;
- m.followers++;
- }
- }
- }
- void Member::unfollow(Member& m){
- if(&m != this){
- this->Listfoll.erase(m.id);
- this->following--;
- m.followers--;
- }
- }
- int Member::numFollowers(){
- return this->followers;
- }
- int Member::numFollowing(){
- return this->following;
- }
- int Member::count(){
- return totcount;
- }
- bool Member:: check(int id){
- if(this->Listfoll.count(id)>0){
- return true;
- }
- return false;
- }
Add Comment
Please, Sign In to add comment