static void Main(string[] args) { SetGet sgobj = new SetGet(); // pass your SetGet object to the login constructor Login login = new Login(sgobj); // call the method to set the login message login.header_message(); // print the login message Console.WriteLine(sgobj.Heading); Console.ReadKey(); }
// accept a SetGet object and store it in the login instance public Login(SetGet setobj) { this.setobj = setobj; }