1.

If a function has to be called only by using other member functions of the class, what should be the access specifier used for that function?(a) Private(b) Protected(c) Public(d) DefaultI got this question in an interview for internship.Origin of the question is Private Access Specifier topic in chapter Access Specifiers of Object Oriented Programming

Answer»

Right option is (a) PRIVATE

Easiest explanation - The function should be MADE private. In this way, the function will be AVAILABLE to be called only from the class member functions. HENCE the function will be secure from the outside WORLD.



Discussion

No Comment Found

Related InterviewSolutions