static void Main(string[] args) { StandardCatalog standardCatalog = new StandardCatalog(); ISaveable saveable = new StandardCatalog(); IPersistable persistable = new StandardCatalog(); Console.WriteLine("Standard Implementation"); Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); Console.WriteLine("ISaveable: {0}", saveable.Save()); Console.WriteLine("IPersistable: {0}", persistable.Save()); Console.WriteLine(); Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)saveable).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)persistable).Save()); Console.WriteLine(); Console.WriteLine("=========================================================="); ExplicitCatalog explicitCatalog = new ExplicitCatalog(); saveable = new ExplicitCatalog(); persistable = new ExplicitCatalog(); Console.WriteLine("Explicit Implementation"); Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); Console.WriteLine("ISaveable: {0}", saveable.Save()); Console.WriteLine("IPersistable: {0}", persistable.Save()); Console.WriteLine(); Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)explicitCatalog).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)explicitCatalog).Save()); Console.WriteLine(); }
static void Main(string[] args) { StandardCatalog standardCatalog = new StandardCatalog(); ISaveable saveable = new StandardCatalog(); IPersistable persistable = new StandardCatalog(); Console.WriteLine("Standard Implementation\n"); Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); Console.WriteLine("ISaveable: {0}", saveable.Save()); Console.WriteLine("IPersistable: {0}", persistable.Save()); Console.WriteLine(); Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)standardCatalog).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)standardCatalog).Save()); Console.WriteLine(); Console.WriteLine("================================================"); ExplicitCatalog explicitCatalog = new ExplicitCatalog(); saveable = new ExplicitCatalog(); persistable = new ExplicitCatalog(); Console.WriteLine("Explicit Implementation\n"); Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); Console.WriteLine("ISaveable: {0}", saveable.Save()); Console.WriteLine("IPersistable: {0}", persistable.Save()); Console.WriteLine(); //quand les cates on revient à nos méthodes d'implémentation d'orgiene Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)explicitCatalog).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)explicitCatalog).Save()); Console.WriteLine(); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("********************* Standard Catalog ***************************"); StandardCatalog sc = new StandardCatalog(); string str = sc.Save(); Console.WriteLine($"Concrete Class {str}"); ISavable sble = new StandardCatalog(); Console.WriteLine($"ISavable {sble.Save()}"); IPersistable pble = new StandardCatalog(); pble.Save(); Console.WriteLine($"IPersistable {pble.Save()}"); Console.WriteLine("********************* Standard Catalog ***************************\n\n"); Console.WriteLine("********************* Explicit Catalog ***************************"); ExplicitCatelog ec = new ExplicitCatelog(); //Console.WriteLine($"Explicit catalog save method {ec.Save()}"); ISavable save = new ExplicitCatelog(); Console.WriteLine($"ISavable in Explicit catalog {save.Save()}"); IPersistable persis = new ExplicitCatelog(); Console.WriteLine($"IPersistable in Explicit catalog {persis.Save()}"); Console.WriteLine("********************* Explicit Catalog ***************************\n\n"); Console.WriteLine($"Casting {((ISavable)ec).Save()}"); Console.WriteLine($"Casting {((IPersistable)ec).Save()}"); }
static void Main(string[] args) { StandardCatalog StandardCatalog = new StandardCatalog(); ISaveable saveable = new StandardCatalog(); IPersistable Persistable = new StandardCatalog(); Console.WriteLine("Standard Implementation\n"); Console.WriteLine("Concreate Clas: {0}", StandardCatalog.Save()); Console.WriteLine("Isaveable: {0}", saveable.Save()); Console.WriteLine("Ipersistable: {0}", Persistable.Save()); Console.WriteLine("\n"); Console.WriteLine("Concreate Clas: {0}", StandardCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)StandardCatalog).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)StandardCatalog).Save()); Console.WriteLine("\n"); Console.WriteLine("================================================================================"); Console.WriteLine("\n"); ExplicitCatalog ExplicitCatalog = new ExplicitCatalog(); saveable = new ExplicitCatalog(); Persistable = new ExplicitCatalog(); Console.WriteLine("Explicit Implementation\n"); Console.WriteLine("Concreate Clas: {0}", ExplicitCatalog.Save()); Console.WriteLine("ISaveable: {0}", saveable.Save()); Console.WriteLine("IPersistable: {0}", Persistable.Save()); Console.WriteLine("\n"); Console.WriteLine("Concreate Clas: {0}", ExplicitCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)ExplicitCatalog).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)ExplicitCatalog).Save()); Console.WriteLine("\n"); Console.ReadLine(); }
static void Main(string[] args) { StandardCatalog standardCatalog = new StandardCatalog(); ISaveable saveable = new StandardCatalog(); IPersistable persistable = new StandardCatalog(); Console.WriteLine("Standard Implementation\n"); Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); Console.WriteLine("ISaveable: {0}", saveable.Save()); Console.WriteLine("IPersistable: {0}", persistable.Save()); Console.WriteLine(); Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)standardCatalog).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)standardCatalog).Save()); Console.WriteLine(); Console.WriteLine("================================================"); ExplicitCatalog explicitCatalog = new ExplicitCatalog(); ISaveable saveableEC = new ExplicitCatalog(); IPersistable persistableEC = new ExplicitCatalog(); Console.WriteLine("Explicit Implementation\n"); //Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); Console.WriteLine("ISaveable: {0}", saveableEC.Save()); Console.WriteLine("IPersistable: {0}", persistableEC.Save()); Console.WriteLine(); //Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)explicitCatalog).Save()); Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)explicitCatalog).Save()); Console.WriteLine(); Console.ReadLine(); }
static void Main(string[] args) { //Standard StandardCatalog standardCatalog = new StandardCatalog(); ISaveable saveable = new StandardCatalog(); IPersistable persistable = new StandardCatalog(); Console.WriteLine("Standard Implementation"); Console.WriteLine("Concrete Class: " + standardCatalog.Save()); Console.WriteLine("ISaveable: " + saveable.Save()); Console.WriteLine("IPersistable: " + persistable.Save()); Console.ReadLine(); //Explicit ExplicitCatalog explicitCatalog = new ExplicitCatalog(); ISaveable eSaveable = new ExplicitCatalog(); IPersistable ePersistable = new ExplicitCatalog(); Console.WriteLine("Explicit Implementation"); Console.WriteLine("Concrete Class: " + explicitCatalog.Save()); Console.WriteLine("ISaveable: " + eSaveable.Save()); Console.WriteLine("IPersistable: " + ePersistable.Save()); Console.ReadLine(); //Casting Console.WriteLine("Explicit Implementation"); Console.WriteLine("Concrete Class: " + explicitCatalog.Save()); Console.WriteLine("(ISaveable)Concrete: " + ((ISaveable)explicitCatalog).Save()); Console.WriteLine("(IPersistable)Concrete: " + ((IPersistable)explicitCatalog).Save()); Console.ReadLine(); //Exlicit Catalog with no Implementation ExplicitCatalog_2 explicitCatalog2 = new ExplicitCatalog_2(); ISaveable eSaveable2 = new ExplicitCatalog_2(); IPersistable ePersistable2 = new ExplicitCatalog_2(); Console.WriteLine("Explicit Implementation (with no implicit implementation)"); //Console.WriteLine("Concrete Class: " + explicitCatalog2.Save()); --Won't work because there is no implicit implementation Console.WriteLine("ISaveable: " + eSaveable2.Save()); Console.WriteLine("IPersistable: " + ePersistable2.Save()); Console.ReadLine(); }
static void Main(string[] args) { //TODO : 04 - Imprimo el mensaje de Save StandardCatalog standardCatalog = new StandardCatalog(); //TODO : 05 - Imprimo el mensaje de Save de mis 2 implementaciones //ISaveable saveable = new StandardCatalog(); //IPersistable persistable = new StandardCatalog(); Console.WriteLine("Standard Implementation\n"); Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); //Console.WriteLine("ISaveable: {0}", saveable.Save()); //Console.WriteLine("IPersistable: {0}", persistable.Save()); Console.WriteLine(); //Console.WriteLine("Concrete Class: {0}", standardCatalog.Save()); //Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)standardCatalog).Save()); //Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)standardCatalog).Save()); //Console.WriteLine(); //Console.WriteLine("================================================"); //TODO : 07 - Imprimo la implementacion explicita //ExplicitCatalog explicitCatalog = new ExplicitCatalog(); //saveable = new ExplicitCatalog(); //persistable = new ExplicitCatalog(); //Console.WriteLine("Explicit Implementation\n"); ////Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); //Console.WriteLine("ISaveable: {0}", saveable.Save()); //Console.WriteLine("IPersistable: {0}", persistable.Save()); //Console.WriteLine(); ////Console.WriteLine("Concrete Class: {0}", explicitCatalog.Save()); //Console.WriteLine("(ISaveable)Catalog: {0}", ((ISaveable)explicitCatalog).Save()); //Console.WriteLine("(IPersistable)Catalog: {0}", ((IPersistable)explicitCatalog).Save()); //Console.WriteLine(); Console.ReadLine(); }