Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Device
- {
- public static Device Create(Type t, Color c) =>
- (t,c) switch
- {
- (typeof(Iphone), Color.Gold) => new GoldIphone()
- (typeof(Ipad), Color.Silver) => new SilverIpad()
- ......
- }
- }
- public class Iphone : Device
- {}
- public class GoldenIphone : Iphone
- {}
- public class Ipad : Device
- {}
- public class SilverIpad : Ipad
- {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement