Beispiel #1
0
        static void Main(string[] args)
        {
            //create AceClass object
            AceClass aceObject = new AceClass();

            aceObject.setName("Bruce Wayne");
            //pass this AceClass object to an AceToAcmeAdapter object
            AceToAcmeAdapter adapter = new AceToAcmeAdapter(aceObject);

            //use Acme methods
            Console.WriteLine("Customer's first name:" + adapter.getFirstName());
            Console.WriteLine("Customer's last name:" + adapter.getLastName());
        }
Beispiel #2
0
 public AceToAcmeAdapter(AceClass a)
 {
     aceObject = a;
     firstname = aceObject.getName().Split()[0];
     lastname  = aceObject.getName().Split()[1];
 }