Object Oriented Programming: Unit II: Inheritance, Packages and Interfaces

What is Protected Member?

Object Oriented Programming

The protected mode allows accessing the members to all the classes and subclasses in the same package as well as to the subclasses in other package. But the non subclasses in other package can not access the protected members.

What is Protected Member?

• Protected mode is another access specifier which is used in inheritance.

• The protected mode allows accessing the members to all the classes and subclasses in the same package as well as to the subclasses in other package. But the non subclasses in other package can not access the protected members.

• For example, if some variable is declared as protected, then the class itself can access it, its subclass can access it, and any class in the same package can also access it.

• Similarly if the variable is declared as private then that variable is accessible by that class only and its subclass or package can not access it.

Object Oriented Programming: Unit II: Inheritance, Packages and Interfaces : Tag: : Object Oriented Programming - What is Protected Member?


Object Oriented Programming: Unit II: Inheritance, Packages and Interfaces



Under Subject


Object Oriented Programming

CS3391 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation



Related Subjects


Discrete Mathematics

MA3354 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Digital Principles and Computer Organization

CS3351 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Foundation of Data Science

CS3352 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Data Structure

CS3301 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Object Oriented Programming

CS3391 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation