Design Pattern 10-Template

xiaoxiao2021-03-06  60

Using system;

namespace Pattern {///

/// Summary description for Class1 /// public abstract class template {public template () {// // TODO:. Add constructor logic here //} public abstract string GetString (); public void act () {string a = getString (); system.console.writeline (A "****" a);}}

Public class temp1: template {private string a; public temp1 (String Temp) {a = TEMP;} public override string getString () {Return A;

}} // Template mode // template a = new temp1 ("kkk"); // a.act (); // a = new temp1 ("xxx"); // a.act ();

转载请注明原文地址:https://www.9cbs.com/read-113098.html

New Post(0)