protected erişim belirteci

1

1Picasso

Confirmed Memb.
Joined
Nov 20, 2019
Messages
88
Reaction score
12
protected erişim belirteci

bir alt sınıfın, üye değişkenlerine ve temel sınıfının üye işlevlerine erişmesine izin verir. protected erişim belirteci kalıtım uygulanmasında yardımcı olur. Kendisini miras olarak kullanan her sınıfta protected üyelere ulaşım sağlanır.

Sekil class
C#:
 class Sekil
    {
        protected double kenar1;
    }
Kare class

C#:
class Kare:Sekil
    {
        
        public void Kenar(double kenar)
        {
            //kalıtım yolu ile kenar1 alındı
            kenar1 = kenar;
        }
        public double AlanGetir()
        {
            return kenar1 * kenar1;
        }
        public void Yazdir()
        {
            Console.WriteLine("Kenar: {0}", kenar1);
            Console.WriteLine("Alan: {0}", AlanGetir());
        }
    }
 
SPAM IS FORBIDDEN!
  • SPAMMERS ARE BANNED FROM THE FORUM AND CANNOT USE ANY OF THE CHEATS
  • For example: thanks, thx, very good, asdqwe, working, ty and so on!
  • For example: Writing the same message over and over. thanks, thx and so on!
  • Copying and copying someone else's message is prohibited.
  • It is forbidden to send messages to increase the number of comments on threads that you have no knowledge of.
  • Write your own opinion when commenting!
  • If you see spam message, please let us know with the REPORT button!

Tema düzenleyici

Top Bottom