Skip to content

Instantly share code, notes, and snippets.

@hsynkrcf
Created November 10, 2022 00:27
Show Gist options
  • Save hsynkrcf/07e67f02d4e4a09cbdb8707328ca951a to your computer and use it in GitHub Desktop.
Save hsynkrcf/07e67f02d4e4a09cbdb8707328ca951a to your computer and use it in GitHub Desktop.
YES OCP
public abstract class Phone
{
public abstract void Make();
}
public class Iphone : Phone
{
public override void Make()
{
Console.WriteLine("Iphone Created\n");
}
}
public class Samsung : Phone
{
public override void Make()
{
Console.WriteLine("Samsung Created\n");
}
}
public class Xiaomi : Phone
{
public override void Make()
{
Console.WriteLine("Xiaomi Created\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment