コード例 #1
0
        public void ClientMethod(IAbstractFactory factory)
        {
            IAbstractProductEngine productA = factory.CreateProductEngine();
            IAbstractProductBody   productB = factory.CreateProductBody();

            Console.WriteLine(productB.UsefulFunctionBody());
            Console.WriteLine(productB.AnotherUsefulFunctionBody(productA));
        }
コード例 #2
0
        public string AnotherUsefulFunctionBody(IAbstractProductEngine collaborator)
        {
            var result = collaborator.UsefulFunctionEngine();

            return($"The result of the Toyota Body collaborating with the ({result})");
        }