Write 7 differences between "Public" function and
"Private" function?
Answer Posted / shankar
1. Public Functions are available to any member of the
class and Object of the class, while private functions are
available to member functions of the same class.
2. Public functions can be inherited, but private can't.
3. By making function Private we implement encapsulation,
but with public method we don't.
4 Private functions are not available in interfaces.
Interfaces only contains Public methods.
5. Private Method though it declare Static will not be
available By using Class Name.
7. Private functions can never be declared as abstract but
Public functions can be.
6. Public functions are defined using 'Public' keyword and
Private functions are defined using 'Private' keyword.
| Is This Answer Correct ? | 52 Yes | 2 No |
Post New Answer View All Answers
How do you achieve polymorphism?
Why interface is used?
What is object-oriented programming? Webopedia definition
What is class and object in oops?
Is react oop?
What is the significance of classes in oop?
Why is encapsulation used?
Explain virtual inheritance?
write a program that takes input in digits and display the result in words from 1 to 1000
What is polymorphism oop?
Why is abstraction needed?
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
What is oops?what is its use in software engineering?
What is and I oop mean?
What is object and example?