Nigil
2/21/2008 11:09:00 AM
Hi Guy,
I am having issues casting my _Propery back to the _User. Can someone kindly
advise me.
Following is the code.
using System;
class Property
{
private string _Name="";
public string Name
{
get {return _Name;}
set {_Name=value;}
}
}
class User:Property
{
private string _ID="";
public string ID
{
get {return _ID;}
set {_ID=value;}
}
}
class App
{
public static void Main(string[] args)
{
User _User=new User();
Property _Property=new Property();
_Property.Name="Lavey";
_User=(Property)_Property; // Here is where the compiler throws error.
Console.WriteLine(_User.Name);
Console.Read();
}
}