samedi 27 octobre 2018

Singleton Polymorphism

Let's assume that i have singleton respresentation of chess board consist of double dimnesion array of cells. Sometimes I want that representation to be consider as board of rows, sometimes as colmumns, sometimes as grids, but every of this case must work on the same underlying singleton of board

So i have 4 class to implement:

class CheesBoard : singleton consist of just a stright dd array of cells
class CheesBoardAsGrids : consist of that same cells but presented by grids
class CheesBoardAsRows : strigtforward as above but rows
class CheesBoardAsColumns : ... you already get it

And i dont know how to implement it to be the most readable and reusable

Aucun commentaire:

Enregistrer un commentaire