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
What is purpose of inheritance?
What is encapsulation and abstraction? How are they implemented in C++?
What are main features of oop?
What is the problem with multiple inheritance?
Is html an oop?
How do you define social class?
Why interface is used?
which feature are not hold visual basic of oop?
what's the basic's in dot net
Why is abstraction needed?
What are the two different types of polymorphism?
Why is encapsulation used?
Which type does string inherit from?
What are the benefits of polymorphism?
What is polymorphism explain its types?