├── .idea └── .idea.DesignPatternAbstractFactory │ └── .idea │ ├── .gitignore │ ├── encodings.xml │ └── indexLayout.xml ├── DesignPatternAbstractFactory.csproj ├── DesignPatternAbstractFactory.sln ├── Factory ├── AbstractFactory.cs ├── LargeGroupFactory.cs └── SmallGroupFactory.cs ├── Models ├── Boat.cs ├── Bus.cs ├── Car.cs ├── Cruise.cs └── Vehicle.cs ├── Program.cs └── obj ├── Debug └── netcoreapp3.1 │ ├── .NETCoreApp,Version=v3.1.AssemblyAttributes.cs │ ├── DesignPatternAbstractFactory.AssemblyInfo.cs │ ├── DesignPatternAbstractFactory.AssemblyInfoInputs.cache │ ├── DesignPatternAbstractFactory.GeneratedMSBuildEditorConfig.editorconfig │ ├── DesignPatternAbstractFactory.assets.cache │ └── DesignPatternAbstractFactory.csproj.AssemblyReference.cache ├── DesignPatternAbstractFactory.csproj.nuget.dgspec.json ├── DesignPatternAbstractFactory.csproj.nuget.g.props ├── DesignPatternAbstractFactory.csproj.nuget.g.targets ├── project.assets.json ├── project.nuget.cache ├── project.packagespec.json └── rider.project.restore.info /.idea/.idea.DesignPatternAbstractFactory/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Rider ignored files 5 | /.idea.DesignPatternAbstractFactory.iml 6 | /projectSettingsUpdater.xml 7 | /modules.xml 8 | /contentModel.xml 9 | # Editor-based HTTP Client requests 10 | /httpRequests/ 11 | # Datasource local storage ignored files 12 | /dataSources/ 13 | /dataSources.local.xml 14 | -------------------------------------------------------------------------------- /.idea/.idea.DesignPatternAbstractFactory/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/.idea.DesignPatternAbstractFactory/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DesignPatternAbstractFactory.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DesignPatternAbstractFactory.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30406.217 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DesignPatternAbstractFactory", "DesignPatternAbstractFactory.csproj", "{C1271D33-5053-4F5A-A995-984A097C5044}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C1271D33-5053-4F5A-A995-984A097C5044}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C1271D33-5053-4F5A-A995-984A097C5044}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C1271D33-5053-4F5A-A995-984A097C5044}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {C1271D33-5053-4F5A-A995-984A097C5044}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {6BF523C6-4B11-4559-86D3-D2E1A460A112} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Factory/AbstractFactory.cs: -------------------------------------------------------------------------------- 1 | using DesignPatternAbstractFactory.Models; 2 | 3 | namespace DesignPatternAbstractFactory.Factory 4 | { 5 | abstract class AbstractFactory 6 | { 7 | public abstract Vehicle CreateLandVehicle(); 8 | public abstract Vehicle CreateSeaVehicle(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Factory/LargeGroupFactory.cs: -------------------------------------------------------------------------------- 1 | using DesignPatternAbstractFactory.Models; 2 | 3 | namespace DesignPatternAbstractFactory.Factory 4 | { 5 | class LargeGroupFactory : AbstractFactory 6 | { 7 | public override Vehicle CreateLandVehicle() 8 | { 9 | return new Bus(); 10 | } 11 | 12 | public override Vehicle CreateSeaVehicle() 13 | { 14 | return new Cruise(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Factory/SmallGroupFactory.cs: -------------------------------------------------------------------------------- 1 | using DesignPatternAbstractFactory.Models; 2 | 3 | namespace DesignPatternAbstractFactory.Factory 4 | { 5 | class SmallGroupFactory : AbstractFactory 6 | { 7 | public override Vehicle CreateLandVehicle() 8 | { 9 | return new Car(); 10 | } 11 | 12 | public override Vehicle CreateSeaVehicle() 13 | { 14 | return new Boat(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Models/Boat.cs: -------------------------------------------------------------------------------- 1 | namespace DesignPatternAbstractFactory.Models 2 | { 3 | class Boat :Vehicle 4 | { 5 | public Boat() 6 | { 7 | capacity = 50; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Models/Bus.cs: -------------------------------------------------------------------------------- 1 | namespace DesignPatternAbstractFactory.Models 2 | { 3 | class Bus :Vehicle 4 | { 5 | public Bus() 6 | { 7 | capacity = 60; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Models/Car.cs: -------------------------------------------------------------------------------- 1 | namespace DesignPatternAbstractFactory.Models 2 | { 3 | class Car : Vehicle 4 | { 5 | public Car() 6 | { 7 | capacity = 5; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Models/Cruise.cs: -------------------------------------------------------------------------------- 1 | namespace DesignPatternAbstractFactory.Models 2 | { 3 | class Cruise : Vehicle 4 | { 5 | public Cruise() 6 | { 7 | capacity = 250; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Models/Vehicle.cs: -------------------------------------------------------------------------------- 1 | namespace DesignPatternAbstractFactory.Models 2 | { 3 | public abstract class Vehicle 4 | { 5 | internal int capacity; 6 | public string GetData() 7 | { 8 | return GetType().Name; 9 | } 10 | public int GetCapacity() 11 | { 12 | return capacity; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using DesignPatternAbstractFactory.Factory; 2 | using System; 3 | 4 | namespace DesignPatternAbstractFactory 5 | { 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | AbstractFactory factory = null; 11 | Console.WriteLine("Hello. How many passengers do you need?"); 12 | int passengers = Convert.ToInt32(Console.ReadLine()); 13 | if (passengers > 15) 14 | factory = new LargeGroupFactory(); 15 | else 16 | factory = new SmallGroupFactory(); 17 | 18 | var landVehicle = factory.CreateLandVehicle(); 19 | var seaVehicle = factory.CreateSeaVehicle(); 20 | Console.WriteLine("Land Vehicle : " + landVehicle.GetData() + ". With capacity of: " + landVehicle.GetCapacity()); 21 | Console.WriteLine("Sea Vehicle : " + seaVehicle.GetData() + ". With capacity of: " + seaVehicle.GetCapacity()); 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /obj/Debug/netcoreapp3.1/DesignPatternAbstractFactory.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | using System.Reflection; 12 | 13 | [assembly: System.Reflection.AssemblyCompanyAttribute("DesignPatternAbstractFactory")] 14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 15 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 16 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 17 | [assembly: System.Reflection.AssemblyProductAttribute("DesignPatternAbstractFactory")] 18 | [assembly: System.Reflection.AssemblyTitleAttribute("DesignPatternAbstractFactory")] 19 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 20 | 21 | // Generated by the MSBuild WriteCodeFragment class. 22 | 23 | -------------------------------------------------------------------------------- /obj/Debug/netcoreapp3.1/DesignPatternAbstractFactory.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 5070d6a47973476acdfb61a3ce1c975afcce3b26 2 | -------------------------------------------------------------------------------- /obj/Debug/netcoreapp3.1/DesignPatternAbstractFactory.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.RootNamespace = DesignPatternAbstractFactory 3 | build_property.ProjectDir = E:\Repos\Articles-master\DesignPatternAbstractFactory\ 4 | -------------------------------------------------------------------------------- /obj/Debug/netcoreapp3.1/DesignPatternAbstractFactory.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nirzaf/DesignPatternAbstractFactory/ba31f85ed96ea81e661b2429d647c2aae643ae3d/obj/Debug/netcoreapp3.1/DesignPatternAbstractFactory.assets.cache -------------------------------------------------------------------------------- /obj/Debug/netcoreapp3.1/DesignPatternAbstractFactory.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nirzaf/DesignPatternAbstractFactory/ba31f85ed96ea81e661b2429d647c2aae643ae3d/obj/Debug/netcoreapp3.1/DesignPatternAbstractFactory.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /obj/DesignPatternAbstractFactory.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj": {} 5 | }, 6 | "projects": { 7 | "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj", 11 | "projectName": "DesignPatternAbstractFactory", 12 | "projectPath": "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj", 13 | "packagesPath": "C:\\Users\\Fazrin\\.nuget\\packages\\", 14 | "outputPath": "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "configFilePaths": [ 17 | "C:\\Users\\Fazrin\\AppData\\Roaming\\NuGet\\NuGet.Config", 18 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 19 | ], 20 | "originalTargetFrameworks": [ 21 | "netcoreapp3.1" 22 | ], 23 | "sources": { 24 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 25 | "https://api.nuget.org/v3/index.json": {} 26 | }, 27 | "frameworks": { 28 | "netcoreapp3.1": { 29 | "targetAlias": "netcoreapp3.1", 30 | "projectReferences": {} 31 | } 32 | }, 33 | "warningProperties": { 34 | "warnAsError": [ 35 | "NU1605" 36 | ] 37 | } 38 | }, 39 | "frameworks": { 40 | "netcoreapp3.1": { 41 | "targetAlias": "netcoreapp3.1", 42 | "imports": [ 43 | "net461", 44 | "net462", 45 | "net47", 46 | "net471", 47 | "net472", 48 | "net48" 49 | ], 50 | "assetTargetFallback": true, 51 | "warn": true, 52 | "frameworkReferences": { 53 | "Microsoft.NETCore.App": { 54 | "privateAssets": "all" 55 | } 56 | }, 57 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.300\\RuntimeIdentifierGraph.json" 58 | } 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /obj/DesignPatternAbstractFactory.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Fazrin\.nuget\packages\ 9 | PackageReference 10 | 6.0.0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /obj/DesignPatternAbstractFactory.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /obj/project.assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "targets": { 4 | ".NETCoreApp,Version=v3.1": {} 5 | }, 6 | "libraries": {}, 7 | "projectFileDependencyGroups": { 8 | ".NETCoreApp,Version=v3.1": [] 9 | }, 10 | "packageFolders": { 11 | "C:\\Users\\Fazrin\\.nuget\\packages\\": {} 12 | }, 13 | "project": { 14 | "version": "1.0.0", 15 | "restore": { 16 | "projectUniqueName": "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj", 17 | "projectName": "DesignPatternAbstractFactory", 18 | "projectPath": "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj", 19 | "packagesPath": "C:\\Users\\Fazrin\\.nuget\\packages\\", 20 | "outputPath": "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\obj\\", 21 | "projectStyle": "PackageReference", 22 | "configFilePaths": [ 23 | "C:\\Users\\Fazrin\\AppData\\Roaming\\NuGet\\NuGet.Config", 24 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 25 | ], 26 | "originalTargetFrameworks": [ 27 | "netcoreapp3.1" 28 | ], 29 | "sources": { 30 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 31 | "https://api.nuget.org/v3/index.json": {} 32 | }, 33 | "frameworks": { 34 | "netcoreapp3.1": { 35 | "targetAlias": "netcoreapp3.1", 36 | "projectReferences": {} 37 | } 38 | }, 39 | "warningProperties": { 40 | "warnAsError": [ 41 | "NU1605" 42 | ] 43 | } 44 | }, 45 | "frameworks": { 46 | "netcoreapp3.1": { 47 | "targetAlias": "netcoreapp3.1", 48 | "imports": [ 49 | "net461", 50 | "net462", 51 | "net47", 52 | "net471", 53 | "net472", 54 | "net48" 55 | ], 56 | "assetTargetFallback": true, 57 | "warn": true, 58 | "frameworkReferences": { 59 | "Microsoft.NETCore.App": { 60 | "privateAssets": "all" 61 | } 62 | }, 63 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.300\\RuntimeIdentifierGraph.json" 64 | } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /obj/project.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "dgSpecHash": "qMfNcUe+AfuwGPmBfZ9K7/QHhv0vdjZIcaTu126DPrxLIBAYe/D41PGj1TfPGcO7eTg3mRoNogVABUVxpAMxOQ==", 4 | "success": true, 5 | "projectFilePath": "E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj", 6 | "expectedPackageFiles": [], 7 | "logs": [] 8 | } -------------------------------------------------------------------------------- /obj/project.packagespec.json: -------------------------------------------------------------------------------- 1 | "restore":{"projectUniqueName":"E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj","projectName":"DesignPatternAbstractFactory","projectPath":"E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\DesignPatternAbstractFactory.csproj","outputPath":"E:\\Repos\\Articles-master\\DesignPatternAbstractFactory\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["netcoreapp3.1"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"netcoreapp3.1":{"targetAlias":"netcoreapp3.1","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"netcoreapp3.1":{"targetAlias":"netcoreapp3.1","imports":["net461","net462","net47","net471","net472","net48"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\6.0.300\\RuntimeIdentifierGraph.json"}} -------------------------------------------------------------------------------- /obj/rider.project.restore.info: -------------------------------------------------------------------------------- 1 | 16552308232444288 --------------------------------------------------------------------------------