public object Clone() { //throw new NotImplementedException(); Blok b = null; if (this is BlokGaris) { b = new BlokGaris(); } else if (this is BlokKotak) { b = new BlokKotak(); } else if (this is BlokKros) { b = new BlokKros(); } else if (this is BlokZNormal) { b = new BlokZNormal(); } else if (this is BlokZTerbalik) { b = new BlokZTerbalik(); } else if (this is BlokLNormal) { b = new BlokLNormal(); } else if (this is BlokLTerbalik) { b = new BlokLTerbalik(); } b.koordKiriAtas = this.koordKiriAtas; b._warnaBlok = this._warnaBlok; for (int i = 0; i < LEBAR; i++) { for (int j = 0; j < PANJANG; j++) { b._elemen[i, j] = this._elemen[i, j]; } } return(b); }
public static Blok BuatkanBlok(int spesifikasi) { Blok b = null; switch (spesifikasi) { case Blok.BARIS: b = new BlokGaris(); break; case Blok.KOTAK: b = new BlokKotak(); break; case Blok.KROS: b = new BlokKros(); break; case Blok.ZNORMAL: b = new BlokZNormal(); break; case Blok.ZTERBALIK: b = new BlokZTerbalik(); break; case Blok.LNORMAL: b = new BlokLNormal(); break; case Blok.LTERBALIK: b = new BlokLTerbalik(); break; } return(b); }