Created
May 11, 2012 01:42
-
-
Save nelsonlaquet/2656977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using ClassLibrary1; | |
namespace ConsoleApplication1 | |
{ | |
static class Whoa | |
{ | |
public static int GetInt(string from) | |
{ | |
Console.WriteLine("Getting an int from {0}", from); | |
return 4; | |
} | |
} | |
class Base | |
{ | |
private int _baseStuff; | |
public Base() | |
{ | |
_baseStuff = Whoa.GetInt("Base._baseStuff"); | |
Whoa.GetInt("From base ctor"); | |
} | |
} | |
class Person : Base | |
{ | |
private int _health; | |
private int _mana; | |
private int _whoa; | |
public Person() | |
{ | |
_health = Whoa.GetInt("Person._health"); | |
_mana = Whoa.GetInt("Person._mana"); | |
_whoa = Whoa.GetInt("Person._whoa"); | |
Whoa.GetInt("From person ctor"); | |
} | |
public void TakeDamage(int damage) | |
{ | |
_health -= damage; | |
if (_health > 0) | |
return; | |
Console.WriteLine("YOU DIED!"); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var p = new Person(); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment