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

design class for linked list and include constructor,destructor,insert option. struct node { int node; struct node &ptr; }

1 Answers   HSBC,


What is use of overloading?

0 Answers  


What is abstraction in oops?

0 Answers  


Conversion from a basic type to a class type may be achieved using______________

5 Answers   HCL,


Why is static class not inherited?

0 Answers  


officer say me - i am offered to a smoking , then what can you say

0 Answers  


Which keyword is written to use a variable declared in one class in the other class?

5 Answers   TCS,


Write an operator overloading program to Overload ‘>’ operator so as to find greater among two instances of the class.

1 Answers  


Write an operator overloading program to write S3+=S2.

2 Answers  


• What are the desirable attributes for memory managment?

0 Answers  


write a program which best describes polymorphism in real world?

2 Answers   CTS, Infosys, NexGen,


Why static Function is used in C++?

4 Answers   TCS,


Categories