Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Archive
product-list
Commits
ac25357c
Commit
ac25357c
authored
May 06, 2016
by
Jake Howard
Browse files
Added base class for inheritance
parent
ca79e66d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Base.cs
0 → 100644
View file @
ac25357c
using
System
;
namespace
productlist
{
class
Base
{
public
string
getName
()
{
return
this
.
getType
().
Name
;
}
}
}
Product.cs
View file @
ac25357c
...
...
@@ -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
()
{
...
...
product-list.csproj
View file @
ac25357c
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment