Skip to content

Commit 771b821

Browse files
committed
added comments to clarify
1 parent 0cbd785 commit 771b821

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

code/AbstractFactory/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,23 @@ using namespace std;
88

99
int main(int argc, char *argv[])
1010
{
11+
//Create factory1
1112
AbstractFactory * fc = new ConcreteFactory1();
13+
14+
//Create products A and B from factory1
1215
AbstractProductA * pa = fc->createProductA();
1316
AbstractProductB * pb = fc->createProductB();
17+
18+
//Use products A and B from factory1
1419
pa->use();
1520
pb->eat();
1621

22+
//Create factory2
1723
AbstractFactory * fc2 = new ConcreteFactory2();
24+
//Create products A and B from factory2
1825
AbstractProductA * pa2 = fc2->createProductA();
1926
AbstractProductB * pb2 = fc2->createProductB();
27+
//Use products A and B from factory2
2028
pa2->use();
2129
pb2->eat();
2230

0 commit comments

Comments
 (0)