diff --git a/Base.cs b/Base.cs new file mode 100644 index 0000000..223c401 --- /dev/null +++ b/Base.cs @@ -0,0 +1,12 @@ +using System; + +namespace productlist +{ + class Base + { + public string getName() { + return this.getType().Name; + } + + } +} diff --git a/Product.cs b/Product.cs index 28e850c..54f04fa 100644 --- a/Product.cs +++ b/Product.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; namespace productlist { - public class Product + public class Product : Base { public string name; public int version; @@ -34,7 +34,8 @@ namespace productlist } public override string ToString() { - return String.Format ("Product {0}", this.name); + string className = this.getName(); + return String.Format ("{0} {1}", className, this.name); } public string serialize() { diff --git a/product-list.csproj b/product-list.csproj index 275a0e3..08614a4 100644 --- a/product-list.csproj +++ b/product-list.csproj @@ -41,6 +41,7 @@ +