Search
 
SCRIPT & CODE EXAMPLE
 

CPP

facade pattern C++ code

#include <iostream>

// Subsystem 1
class SubSystemOne
{
public:
	void MethodOne(){ std::cout << "SubSystem 1" << std::endl; };
};

// Subsystem 2
class SubSystemTwo
{
public:
	void MethodTwo(){ std::cout << "SubSystem 2" << std::endl; };
};

// Subsystem 3 
class SubSystemThree
{
public:
	void MethodThree(){ std::cout << "SubSystem 3" << std::endl; }
};


// Facade
class Facade
{
public:
    Facade()
    {
	pOne = new SubSystemOne();
	pTwo = new SubSystemTwo();
	pThree = new SubSystemThree();
    }

    void MethodA()
    {
	std::cout << "Facade::MethodA" << std::endl;
	pOne->MethodOne();
	pTwo->MethodTwo();
    }

    void MethodB()
    {
	std::cout << "Facade::MethodB" << std::endl;
	pTwo->MethodTwo();
	pThree->MethodThree();
    }

private:
    SubSystemOne *pOne;
    SubSystemTwo *pTwo;
    SubSystemThree *pThree;
};

int main()
{
    Facade *pFacade = new Facade();

    pFacade->MethodA();
    pFacade->MethodB();

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: Equalize problem codeforces 
Cpp :: how to use run total in C++ 
Cpp :: tan trigonometric function 
Cpp :: C++ Converting Celsius to Kelvin 
Cpp :: comment installer boost c++ sur windows 
Cpp :: input many numbers to int c++ 
Cpp :: KUNG FU HUSTLE 
Cpp :: Buy 2 Get 1 Free codechef solution in c++ 
Cpp :: command loop ctrl D c++ 
Cpp :: statement that causes a function to end in c++ 
Cpp :: C++ Vector Initialization method 01 
Cpp :: 400 watt hour per kg 
Cpp :: delete an dynamic array 
Cpp :: friend class in c++ 
Cpp :: second smallest element using single loop 
Cpp :: linked 
Cpp :: std::hash 
Cpp :: all usefull stls in cpp imports 
Cpp :: c++ insert vector into vector 
Cpp :: catalan numbers c++ 
Cpp :: count substrings codechef solution in c++ 
Cpp :: c++ to assembly 
Cpp :: changing key bindings in visual code not working 
Cpp :: 12 to december in c++ code 
Cpp :: bitmap rotate 90 deg 
Cpp :: sort sub vector, sort range of vector c++ 
Cpp :: are maps sorted c++ 
Cpp :: how to call subclass override method in c++ 
Cpp :: c++ how to get maximum value 
Cpp :: modify value in map c++ 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =