Write 7 differences between "Public" function and
"Private" function?

Answers were Sorted based on User's Feedback



Write 7 differences between "Public" function and "Private" function?..

Answer / 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

Write 7 differences between "Public" function and "Private" function?..

Answer / sriram

we can't access private function to the outside of the
package simply the scope of the function is with in the
function only

Is This Answer Correct ?    10 Yes 14 No

Post New Answer

More OOPS Interview Questions

What is difference between multiple inheritance and multilevel inheritance?

0 Answers  


What is use of overloading?

0 Answers  


Program to print 0 to 9 in cross order

3 Answers  


Write a program to accept a number and to print numbers in pyramid format? for eg:for a no. 5 1 212 32123 4321234 543212345

7 Answers  


What do you mean by inline function?

6 Answers  






class type to basic type conversion

0 Answers  


to remove the repeated numbers from the given . i.e.., if the input is 12233 output should of 123

2 Answers  


what is the basic concept of inheritance?

9 Answers  


What is the main difference between C++ and Java

11 Answers   TCS,


What is this pointer in oop?

0 Answers  


What is sub classing in c++?

1 Answers  


Is html an oop?

0 Answers  


Categories