المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : inheriting varibles from within a class



C# Programming
05-13-2009, 06:30 AM
hey im new here

basically im using c# i need to write to a varible then out put it from diffrent classes


public class profile
{
public string postcode;

public void profileupdate()
{

Console.WriteLine("please enter postcode");
postcode = Console.ReadLine();
}
}


im trying to inherit in this class


public class print
{
public void printseat()
{
profile profileupdate = new profile();

Console.WriteLine("" + profileupdate.postcode + "");
System.Threading.Thread.Sleep(1000000);
}
}


i have a feeling it is because im inheriting a new instance of the varible but im not sure how to overcome it?