Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改了Builder类的Product指针为Product #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/Builder/Builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ void Builder::buildPartC(){


Product* Builder::getResult(){
return m_prod;
}
return &m_prod;
}
2 changes: 1 addition & 1 deletion code/Builder/Builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ class Builder
virtual void buildPartC();
virtual Product * getResult();
protected :
Product * m_prod;
Product m_prod;
};
#endif // !defined(EA_938F1725_29F0_4174_93A3_D49DAB5D16A0__INCLUDED_)
8 changes: 4 additions & 4 deletions code/Builder/ConcreteBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ ConcreteBuilder::~ConcreteBuilder(){
}

void ConcreteBuilder::buildPartA(){
m_prod->setA("A Style "); //不同的建造者,可以实现不同产品的建造
m_prod.setA("A Style "); //不同的建造者,可以实现不同产品的建造
}


void ConcreteBuilder::buildPartB(){
m_prod->setB("B Style ");
m_prod.setB("B Style ");
}


void ConcreteBuilder::buildPartC(){
m_prod->setC("C style ");
}
m_prod.setC("C style ");
}