inheriting from new class

May 12 2009 5:18 PM

hey im new here

basically im using c# i need to write to a varible then out put it from diffrent classes
[code]
 public class profile
    {
        public string postcode;

        public void profileupdate()
        {
           
            Console.WriteLine("please enter postcode");
            postcode = Console.ReadLine();
        }
    }
[/code]

im trying to inherit in this class
[code]
  public class print
    {
        public void printseat()
        {
            profile profileupdate = new profile();
           
            Console.WriteLine("" + profileupdate.postcode + "");
            System.Threading.Thread.Sleep(1000000);
        }
    }
[/code]

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


Answers (1)