السلام عليكم
انا بصراحة عضوة جديدة فى المنتدى وبتمنى تقبلونى كأخت ليكم
وانا بدرس هندسة حاسوب وطلب منا الدكتور البحث عن هذا السؤال "هل كل private member تورث وشرح بسيط جدا "
بس ياريت يكون باللغة الانجليزية وعشان انا افهمه بالعربى وبكون مشكورة كتير
السلام عليكم
انا بصراحة عضوة جديدة فى المنتدى وبتمنى تقبلونى كأخت ليكم
وانا بدرس هندسة حاسوب وطلب منا الدكتور البحث عن هذا السؤال "هل كل private member تورث وشرح بسيط جدا "
بس ياريت يكون باللغة الانجليزية وعشان انا افهمه بالعربى وبكون مشكورة كتير
Java uses three explicit keywords to set the boundaries in a class: public,
private, and protected. Their use and meaning are quite
straightforward. These access specifiers determine who can use the
definitions that follow. public means the following element is available to
everyone. The private keyword, on the other hand, means that no one
can access that element except you, the creator of the type, inside
methods of that type. private is a brick wall between you and the client
programmer. If someone tries to access a private member, they’ll get a
compile-time error. protected acts like private, with the exception that
an inheriting class has access to protected members, but not private
members.
Java also has a “default” access, which comes into play if you don’t use
one of the aforementioned specifiers. This is usually called package
access because classes can access the members of other classes in the
same package, but outside of the package those same members appear to
be private.
Reference: Thinking in Java, Bruce Eckel, p75
تم تعديل هذه المشاركة بواسطة JDurrah في 17 مارس 2010 في 14:49
لو كان الـ variable او الـ method برايفت بيكون خاص بنفس الكلاس ما يورثه الـsubclass واحضار قيمتة او تغيرها يكون عن طريق الـ accessor و mutator ميثودز
الأخ الكريم/الأخت الكريمة
السلام عليكم ورحمة الله وبركاته
مرحباً بكم في منتدى الفريق العربي للبرمجة
نود تنبيهك أن العنوان غير مناسب.
الرجاء اختيار عنوان مناسب أكثر في مواضيعك القادمة، وهذا بمثابة إشعار للأهمية.
وفي حال التكرار سيتعرض موضوعك للإغلاق والحذف!!!
قواعد المشاركة
شاكرين لكم حُسن تعاونكم
المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية
جارٍ التحقق من المتواجدين…