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 are functions in oop?

0 Answers  


Who invented oop?

0 Answers  


Write a c++ program to display pass and fail for three student using static member function

0 Answers  


What do you mean by abstraction?

0 Answers  


what is the difference between class to class type conversion and copy constructor ?

2 Answers  






What is encapsulation example?

0 Answers  


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

0 Answers   TCS,


write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.

0 Answers   Wipro,


C#.net Interview Question A=10 B=5 C=A+B Print C The above will be given in a multiline textbox. You need to parse the above input, store values for A,B&c. And you have to display the value of C.

1 Answers   Syncfusion,


What is polymorphism in oop example?

0 Answers  


What is difference between abstraction and encapsulation?

0 Answers  


inheritence with example

1 Answers  


Categories