We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cbd785 commit 771b821Copy full SHA for 771b821
code/AbstractFactory/main.cpp
@@ -8,15 +8,23 @@ using namespace std;
8
9
int main(int argc, char *argv[])
10
{
11
+ //Create factory1
12
AbstractFactory * fc = new ConcreteFactory1();
13
+
14
+ //Create products A and B from factory1
15
AbstractProductA * pa = fc->createProductA();
16
AbstractProductB * pb = fc->createProductB();
17
18
+ //Use products A and B from factory1
19
pa->use();
20
pb->eat();
21
22
+ //Create factory2
23
AbstractFactory * fc2 = new ConcreteFactory2();
24
+ //Create products A and B from factory2
25
AbstractProductA * pa2 = fc2->createProductA();
26
AbstractProductB * pb2 = fc2->createProductB();
27
+ //Use products A and B from factory2
28
pa2->use();
29
pb2->eat();
30
0 commit comments