What is a protected heritage?

Informatics area uses programming to create problems solving. C ++ is a programming language used in computer science that uses the orientation of the object to model the real world. In object -oriented programming, classes are created to provide a framework for object models that are used during the operation of the program. Classes are often created in a structured hierarchy, where more generalized parents of parents are first created, then they are used as a basis for more detailed classes of children. Protected inheritance allows the classroom classes to have full and direct access to those predecessor of member items that are inherited into the class of offspring. In C ++, this is achieved using access modifiers. If the programmer wants to deny Access to internal information and class outside information, the keyword "private" -e is always allowed access between members between classes. To limit access only on class of offspring as in protected heritage is used key SLovo “protected”. The keyword "public" allows full access to variable members and functions.

Software inheritance has the advantage that the programming code that has already been created to be indirectly reused. When a child's class is created, all member variables and predecessors' functions have automatically become part of the child. The programmer may not encode them again. This is the main advantage when a large class hierarchy is needed. This is an example of when entities in the biological taxonomy model must be replicated in the software.

Private heritage has become a private predecessors to be private. Children who implicitly accept these variables and functions do not have direct, immediate access to them, thereby retaining certain features of parents and child. With protected inheritance, when a parent declares how protected is inherited variables or functions and the child has access to them, but other classes cannot. BootEjey inheritance allows the child to integrate and manipulate parents. It also allows other structures to access the child members.

Protected inheritance is an important concept in C ++ programming. It helps to define the restrictions under which the program will work. Briefly written and well -equipped programs that use inheritance, help reduce application errors, help eliminate problems, and provide controlled flexibility with standard object -oriented principles of hiding and encapsulation.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?