Esempio n. 1
0
        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("============================");

            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();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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();
        }