Помощь - Поиск - Пользователи - Календарь
Полная версия: private & public
Форум «Всё о Паскале» > Pascal, Object Pascal > Теоретические вопросы
Muggsy_rule
объясните как работают эти ключевые слова! ???
ozzy
public (standard directive)
____________________________
Public and private act as reserved words within object type declarations but
are otherwise treated as directives.

Component identifiers declared in public component sections have no special
restrictions on their scope.

 private (standard directive)
 ______________________________
Private and public are reserved words only within objects.

The scope of component identifiers declared in private component sections
are restricted to the module (program or unit) that contains the object type
declaration.

   - Inside the module, private component identifiers act like normal public
     component identifiers.
   - Outside the module, private component identifiers are unknown and
     inaccessible.

Place related object types in the same module (or unit) where they can gain
access to each other's private components without making the private
components known to other's modules.


 
Muggsy_rule
ага ..... только вот еще бы не на буржунском языке.....ну все равно шпасибки.... ;)
Alex
Все что обьявленно внутри объекта после директивы private может быть доступно только внутри объекта и соответственно использоваться ТОЛЬКО внутри него, также их могут использовать потомки этого обьекта родителя!!!!!
Все что объявленно после public может быть доступно в любом месте программы, а также использоваться с дальней моделью вызова!!!!!! По умолчанию, то есть если никаких директив не объявлять, стоит public!!!!!!!!
Private используется для повышения надежности программы!!!!!!!
Это текстовая версия — только основной контент. Для просмотра полной версии этой страницы, пожалуйста, нажмите сюда.