Пример #1
0
 public void Departure(MobilePhone mobile)
 {
     Console.WriteLine("Normal Mobile Departure");
 }
Пример #2
0
 public void ProofOfDelivery(MobilePhone mobile)
 {
     Console.WriteLine("Normal Mobile Proof Of Delivery");
 }
Пример #3
0
        public static void GenericMain()
        {
            Book book = new Book();

            book.Contents = "Computer Science Contents";
            book.Price    = 500;
            book.Author   = "Farasat";

            BookTranport bookTranport = new BookTranport();

            bookTranport.Departure(book);
            bookTranport.Delivery(book);
            bookTranport.ProofOfDelivery(book);

            MobilePhone mobile = new MobilePhone();

            mobile.Brand    = "Samsung";
            mobile.ModelNum = "Note10";
            mobile.Price    = 1200;
            mobile.Made     = "US";

            MobilePhoneTranport mobilePhoneTranport = new MobilePhoneTranport();

            mobilePhoneTranport.Departure(mobile);
            mobilePhoneTranport.Delivery(mobile);
            mobilePhoneTranport.ProofOfDelivery(mobile);

            //Object Transport
            //Though it can transport any type of object but in this case there is type casting overhead
            ObjectTransport objectTransport = new ObjectTransport();

            objectTransport.Departure(book);
            objectTransport.Delivery(book);
            objectTransport.ProofOfDelivery(book);

            //Template
            //It can transport any type of object and in this case there is no type casting overhead
            Transport <Book> bookTransp = new Transport <Book>();

            bookTransp.Departure(book);
            bookTransp.Delivery(book);
            bookTransp.ProofOfDelivery(book);

            Utility.SaveProductInDB <Book>(book);
            double bookFees = Utility.GetTransportationFees <Book>(book);

            Transport <MobilePhone> mobileTransp = new Transport <MobilePhone>();

            mobileTransp.Departure(mobile);
            mobileTransp.Delivery(mobile);
            mobileTransp.ProofOfDelivery(mobile);

            //Transport<int> trans = new Transport<int>();

            Utility.SaveProductInDB <MobilePhone>(mobile);
            double mobileFees = Utility.GetTransportationFees <MobilePhone>(mobile);
            //
            ArrayList list = new ArrayList();

            list.Add(1);
            list.Add(3123);
            list.Add(45);

            List <int> intList = new List <int>();

            intList.Add(1);
            intList.Add(3123);
            intList.Add(45);

            Console.ReadLine();
        }