24.04.2010 г.

Understanding OOP theory

#include <Vector>
#include <Map>
#include <String>

struct MaleAuthorityPair{
Male* male;
AuthorityClass* authority;
}

class Female{
public:
Male* getBoyfriend();
virtual bool askForSex(AuthorityClass* autorityClass);
std::vector<String> frequentlyUsedPhrases;
small int maxFrequentlyUsedPhrases;
virtual std::vector<MaleAuthorityPair>* getMaleFriends;

protected:
virtual bool AssertAutorityOfNewCommer(Man* newCommer)){
return newCommer->getAutority() > boyFriend->getAutority();
}

private:
Male* boyFriend;
std::vector<MaleAuthorityPair> CandidateBoyFriends;
std::vector<MaleAuthorityPair> maleFriends;
std::vector<Female> femaleFriends;
std::map<String, String> PoliteTranslatePhraseTable;
//for example TranslatePhraseTable<"don't call me anymore"> = I'll call you later
}


class Wife : public Female{
public:
Husband* husband;
virtual bool askForSex(AuthorityClass* autorityClass);
bool giveMoney(Currency* amount);
bool TakeForAWalk(AuthorityClass* autorityClass);
virtual std::vector<MaleAuthorityPair>* getMaleFriends{
return void;
}
protected:
void BeginTalking();
void StopTalking();
Currency askHusbandForMoney(Currency minAmount);
void GoShoping();
void GoMallShopping(Mall* mall);
virtual bool AssertAutorityOfNewCommer(Male* newCommer){
return newCommer->getAutority() > husband->getAutority();
}
int detectLovers();

private:
std::vector<MaleAuthorityPair> lovers;
int detectLoversOfHusband();
bool findBeaterForLoversOfHusband();
}

Няма коментари: