Commit ac25357c authored by Jake Howard's avatar Jake Howard
Browse files

Added base class for inheritance

parent ca79e66d
using System;
namespace productlist
{
class Base
{
public string getName() {
return this.getType().Name;
}
}
}
......@@ -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() {
......
......@@ -41,6 +41,7 @@
<Compile Include="Product.cs" />
<Compile Include="UI.cs" />
<Compile Include="Storage.cs" />
<Compile Include="Base.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment