answersLogoWhite

0


Best Answer

These are all access modifiers in Java.

a. Public - these are accessible anywhere. This is the least restrictive access specifier.

b. Private - these are accessible only inside the declaring class. This is the most restrictive access specifier.

c. Protected - these are in between public and private. These are accessible to all classes that inherit this class

d. Package - this is the default access specifier. These are accessible to all classes that are present in the same package as the contained class.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Explain the significance of public and protected and private access specifiers in inheritance?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is an inheritance Explain different types of inheritance in c?

C is not an object oriented language and therefore has no native support for inheritance.


Class hierarchy is a fundamental concept of object oriented programs explain what this term means with reference to inheritance abstraction and instantiation?

Class hierarchy is a term used in Java. It is used for identifying the inheritance hierarchy or the parent class relationships Ex: Public class B extends C { } Public class A extends B { } Here if we take the class hierarchy for class 'A' it would be A


Explain types of inheritance in c plus plus?

There are essentially just two types of inheritance: single inheritance and multiple inheritance. Single inheritance simply means that one class derives directly from another class. Multiple inheritance means one class is directly derived from two or more classes. However, since base classes can (and often are) be derived from other base classes, you can think of this type of inheritance as being multi-level. In addition, two or more base classes that share a common base class can use virtual inheritance. What this means is that the common base class becomes a direct base class of the most-derived class, and this one instance is shared, virtually, by all the base classes that would otherwise inherit directly from it. in other words, there is only one instance of the common base class, rather than one instance per class that inherits from it. This is useful in the so-called "dreaded diamond" formation, where a derived class inherits from two base classes, both of which inherit from a common base class.


Explain the difference between public and protected access specifier?

A private variable is only accessible in the class where it was declaredA protected variable is accessible to sub classes and classes in the same package as where they were declared


Explain the different types of constants n variables in C?

explain loop structrunes