C++ Programming Question:
Download Questions PDF

What is public, protected, private in C++?

Answer:

* Public, protected and private are three access specifiers in C++.
* Public data members and member functions are accessible outside the class.
* Protected data members and member functions are only available to derived classes.
* Private data members and member functions can’t be accessed outside the class. However there is an exception can be using friend classes.

Download C++ Programming Interview Questions And Answers PDF

Previous QuestionNext Question
Write a short code using C++ to print out all odd number from 1 to 100 using a for loopWrite a function that swaps the values of two integers, using int* as the argument type.