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
write a program that takes input in digits and display the result in words from 1 to 1000
What does and I oop mean in text?
Why is static class not inherited?
What is polymorphism and its types?
Get me a number puzzle game-program
What is multilevel inheritance explain with example?
What are the 4 pillars of oop?
What are two types of polymorphism?
What is pointer in oop?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
What does and I oop and sksksk mean?
Give two or more real cenario of virtual function and vertual object
Why is there no multiple inheritance?
Can an interface inherit a class?
What is interface in oop?