Example #1
0
        /*
         *  public => excesses from every where
         *  private => excesses within the class
         *  protected => excesses within and to the derived class
         *  interal => exceeable from the same assembly /// very rare it is used
         *  protected internal => accessiable form the same assembly or an derived class
         *
         */
        static void Main(string[] args)
        {
            //public
            var customer = new GoldCustomer();

            customer.OfferVoucher();
        }
Example #2
0
        static void Main(string[] args)
        {
            var customer     = new Customer();
            var goldCustomer = new GoldCustomer();

            goldCustomer.GiveOffer();

            var custome1 = new CustomerCL();
        }
        public void PrintId()
        {
            Customer cus = new Customer();

            Console.WriteLine($" Id = {cus.Id}");
            //Console.WriteLine($" Name = {cus.Name}"); // Name is private
            //Console.WriteLine($" Name = {cus.Title}"); // Name is private

            GoldCustomer gc = new GoldCustomer();

            base.Title = "yesss";
            Console.WriteLine($" Title =   {gc.Title}"); // Derived class is ok to access protected


            base.Age = 1;  // internal can only access within an assembly scope  (dll/exe)
        }