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


Please Help Members By Posting Answers For Below Questions

write a program that takes input in digits and display the result in words from 1 to 1000

1995


What does and I oop mean in text?

631


Why is static class not inherited?

601


What is polymorphism and its types?

607


Get me a number puzzle game-program

1698






What is multilevel inheritance explain with example?

632


What are the 4 pillars of oop?

678


What are two types of polymorphism?

620


What is pointer in oop?

543


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

1660


What does and I oop and sksksk mean?

661


Give two or more real cenario of virtual function and vertual object

1861


Why is there no multiple inheritance?

574


Can an interface inherit a class?

567


What is interface in oop?

666