AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: sonic2001 — October 6, 2006
    +4 votes
      + -

    Public:
    Makes class memebrs accessible outside the class. It can be accessed in the C code.
    Private:
    Makes the members specified accessible only to the class and it’s functions.

  2. Submitted By: chantu — October 6, 2006
    +9 votes
      + -

    public - Anyone can access the method/variable
    protected - The method/variable can only be accessed by classes which inherit from the class in which the method/variable is declared.
    private - The method/variable can only be accessed from within the class where it is declared.

  3. Submitted By: sapyo — October 6, 2006
    +10 votes
      + -

    public / private have two different meanings in C++.

    1. To specify the access privilege of the class members.

    2. To specify what type of inheritance.

  4. Submitted By: Kumar — October 12, 2006
    +1 votes
      + -

    Public: can be accessed from other type of access specifiers, namely a Private class, a protected class or anyother public class.
    This may be extended to C++ and Java

    Private: has restricted access to its member functions declared in this type modifier. Only the members with-in may access them. But there’s a loop hole, what if a variable is declared in Public section of a Private class modifier?

  5. Submitted By: ramu — October 19, 2006
    +0 votes
      + -

    public: the variables and class members that are declared as public can be accessed any where in the program.
    private: the members function can accessed only by that pertical class and inside the class

  6. Submitted By: Praveen — November 17, 2006
    +0 votes
      + -

    Public: The field/Method is accessible out side the class also.

    Private: Fields/Methods restricted and are available inside the class only.

  7. Submitted By: madhusudhan — April 18, 2007
    not yet rated
      + -

    Public: If a variable or methode is declared as public it can be access any where in the program.

    private: if a variable or methode is declared as private it can be access with in the class where declared or member function can only access that class variable.

  8. Submitted By: Al — September 20, 2007
    not yet rated
      + -

    Hey! Don’t forget that ‘friend’s can access private and protected members.

  9. Submitted By: vedant — February 1, 2008
    +1 votes
      + -

    public members can be accesed outside the class where as private can only be accesed by class methods.private cannot be accesed outside the class.
    only with the help of friend functions and friend classes it can be accesed outside the class

  10. Submitted By: srinivas — December 1, 2008
    not yet rated
      + -

    Members declared as public in a c++ program can be accessed anywhere in the program.
    Members declared as private can be accessed only with in the class itself.

  11. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.