Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jason_yao committed Oct 20, 2013
1 parent 6673e9b commit cdd40d4
Show file tree
Hide file tree
Showing 31 changed files with 1,098 additions and 63 deletions.
25 changes: 12 additions & 13 deletions 大話/cpp/brige/BridgeMain.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#include "BridgeMain.h"
using namespace brige;

namespace brige {

void BridgeMain::main(std::string args[]) {
Mobile* nokia = new NokiaMobile("Nokia");
MobileSoft* game = new MobileGame();
nokia->setSoft(game);
nokia->run();
Mobile* moto = new MotoMible("Moto");
MobileSoft* mp3 = new MobileMp3();
moto->setSoft(mp3);
moto->run();
}
}
int main() {
Mobile* nokia = new NokiaMobile("Nokia");
MobileSoft* game = new MobileGame();
nokia->setSoft(game);
nokia->run();
Mobile* moto = new MotoMible("Moto");
MobileSoft* mp3 = new MobileMp3();
moto->setSoft(mp3);
moto->run();
return 0;
}
Binary file added 大話/cpp/brige/BridgeMain.o
Binary file not shown.
334 changes: 334 additions & 0 deletions 大話/cpp/brige/Makefile

Large diffs are not rendered by default.

Binary file added 大話/cpp/brige/Mobile.o
Binary file not shown.
5 changes: 3 additions & 2 deletions 大話/cpp/brige/MobileGame.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "MobileGame.h"
#include <iostream>

namespace brige {

void MobileGame::run() {
puts("run mobile game!");
std::cout << "run mobile game!" << std::endl;
}
}
}
Binary file added 大話/cpp/brige/MobileGame.o
Binary file not shown.
5 changes: 3 additions & 2 deletions 大話/cpp/brige/MobileMp3.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "MobileMp3.h"
#include <iostream>

namespace brige {

void MobileMp3::run() {
puts("run mobile mp3!");
std::cout << "run mobile mp3!" << std::endl;
}
}
}
Binary file added 大話/cpp/brige/MobileMp3.o
Binary file not shown.
Binary file added 大話/cpp/brige/MobileSoft.o
Binary file not shown.
5 changes: 3 additions & 2 deletions 大話/cpp/brige/MotoMible.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "MotoMible.h"
#include <iostream>

namespace brige {

MotoMible::MotoMible(std::string brand) : Mobile(brand) {
}

void MotoMible::run() {
puts("Moto Mobile: ");
std::cout << "Moto Mobile: " << std::endl;
this->getSoft()->run();
}
}
}
Binary file added 大話/cpp/brige/MotoMible.o
Binary file not shown.
5 changes: 3 additions & 2 deletions 大話/cpp/brige/NokiaMobile.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "NokiaMobile.h"
#include <iostream>

namespace brige {

NokiaMobile::NokiaMobile(std::string brand) : Mobile(brand) {
}

void NokiaMobile::run() {
puts("Nokia Mobile: ");
std::cout << "Nokia Mobile: " << std::endl;
this->getSoft()->run();
}
}
}
Binary file added 大話/cpp/brige/NokiaMobile.o
Binary file not shown.
Binary file added 大話/cpp/brige/brige
Binary file not shown.
27 changes: 27 additions & 0 deletions 大話/cpp/brige/brige.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
######################################################################
# Automatically generated by qmake (3.0) ?? 10? 19 21:58:03 2013
######################################################################

TEMPLATE = app
TARGET = brige
INCLUDEPATH += .
CONFIG = warn_on debug
INCLUDEPATH
LIBS


# Input
HEADERS += BridgeMain.h \
Mobile.h \
MobileGame.h \
MobileMp3.h \
MobileSoft.h \
MotoMible.h \
NokiaMobile.h
SOURCES += BridgeMain.cpp \
Mobile.cpp \
MobileGame.cpp \
MobileMp3.cpp \
MobileSoft.cpp \
MotoMible.cpp \
NokiaMobile.cpp
Binary file added 大話/cpp/composite/Company.o
Binary file not shown.
47 changes: 24 additions & 23 deletions 大話/cpp/composite/CompositeMain.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#include "CompositeMain.h"
#include <iostream>
using namespace composite;

namespace composite {

void CompositeMain::main(std::string args[]) {
ConcreteCompany* root = new ConcreteCompany("The Head Office Of Our Company In Beijing");
root->add(new HRDepartment("Head Office HR"));
root->add(new FinanceDepartment("Head Office Finance"));
ConcreteCompany* comp = new ConcreteCompany("The leaf company in shanghai");
comp->add(new HRDepartment("shanghai office HR"));
comp->add(new FinanceDepartment("shanghai office finance"));
root->add(comp);
ConcreteCompany* comp1 = new ConcreteCompany("the office of shanghai company in nanjing");
comp1->add(new HRDepartment("nanjing office HR"));
comp1->add(new FinanceDepartment("nanjing office finance"));
comp->add(comp1);
ConcreteCompany* comp2 = new ConcreteCompany("the office of shanghai company in hangzhou");
comp2->add(new HRDepartment("hangzhou office HR"));
comp2->add(new FinanceDepartment("hangzhou office finance"));
comp->add(comp2);
puts("the structure of our company:");
root->display(1);
puts("the duty of every department:");
root->lineOfDuty();
}
}
int main() {
ConcreteCompany* root = new ConcreteCompany("The Head Office Of Our Company In Beijing");
root->add(new HRDepartment("Head Office HR"));
root->add(new FinanceDepartment("Head Office Finance"));
ConcreteCompany* comp = new ConcreteCompany("The leaf company in shanghai");
comp->add(new HRDepartment("shanghai office HR"));
comp->add(new FinanceDepartment("shanghai office finance"));
root->add(comp);
ConcreteCompany* comp1 = new ConcreteCompany("the office of shanghai company in nanjing");
comp1->add(new HRDepartment("nanjing office HR"));
comp1->add(new FinanceDepartment("nanjing office finance"));
comp->add(comp1);
ConcreteCompany* comp2 = new ConcreteCompany("the office of shanghai company in hangzhou");
comp2->add(new HRDepartment("hangzhou office HR"));
comp2->add(new FinanceDepartment("hangzhou office finance"));
comp->add(comp2);
std::cout << "the structure of our company:" << std::endl;
root->display(1);
std::cout << "the duty of every department:" << std::endl;
root->lineOfDuty();
return 0;
}
Binary file added 大話/cpp/composite/CompositeMain.o
Binary file not shown.
Loading

0 comments on commit cdd40d4

Please sign in to comment.