예제 #1
0
        private void Adapter_Button_Click(object sender, RoutedEventArgs e)
        {
            Student student = new Student();

            Adapter.Pen pen = new Adapter.Pen();
            AdapterTxtbl.Text += student.Stuff(pen) + '\n';
            AdapterTxtbl.Text += "Упс... В ручке стержень закончился \n";

            Chalk chalk      = new Chalk();
            IPen  chalkStuff = new ChalkToPenAdapter(chalk);

            AdapterTxtbl.Text += student.Stuff(chalkStuff) + '\n';
        }
예제 #2
0
 public ChalkToPenAdapter(Chalk c)
 {
     chalk = c;
 }