Skip to content

Instantly share code, notes, and snippets.

@sevperez
Last active September 4, 2018 19:31
Show Gist options
  • Save sevperez/459adb2905ac31fed5942f9596ce582c to your computer and use it in GitHub Desktop.
Save sevperez/459adb2905ac31fed5942f9596ce582c to your computer and use it in GitHub Desktop.
using System;
public class Program
{
public static void Main()
{
NobleGas argon = new NobleGas("Argon", "Ar", 18);
argon.Describe();
}
public class Element
{
public string Name { get; set; }
public string Symbol { get; set; }
public int Number { get; set; }
public Element(string name, string symbol, int number)
{
this.Name = name;
this.Symbol = symbol;
this.Number = number;
}
public virtual void Describe()
{
Console.WriteLine
(
"{0} ({1}) has atomic number {2}.",
this.Name, this.Symbol, this.Number
);
}
}
public class NobleGas : Element
{
public string Category { get; set; }
public string Type { get; set; }
public string Reactivity { get; set; }
public NobleGas(string name, string symbol, int number) : base(name, symbol, number)
{
this.Category = "gas";
this.Type = "noble gas";
this.Reactivity = "low";
}
public override void Describe()
{
Console.WriteLine
(
"{0} ({1}; {2}) is a {3} of type {4}. It has {5} reactivity.",
this.Name, this.Symbol, this.Number,
this.Category, this.Type, this.Reactivity
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment