static void Main(string[] args) { NewClass NewObject = new NewClass(); NewObject.setName("Cary Grant"); LegacyClass adapter = new NewToLegacyAdapter(NewObject); Console.WriteLine("Customer’s first name: " + adapter.getFirstName()); Console.WriteLine("Customer’s last name: " + adapter.getLastName()); Console.ReadKey(); }
public NewToLegacyAdapter(NewClass NewObject) { setFirstName(NewObject.getName().Split(' ')[0]); setLastName(NewObject.getName().Split(' ')[1]); }