What do you mean by public, private, protected and friendly?

Answer Posted / achal ubbott

public means access to the object of the class, created in
outside world.

private and protected are almost the same, except the
difference that protected members are inheritable and thus
can be used by derived class. These can be accessed only by
the public function members of the class.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How long to learn object oriented programming?

563


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

1638


Why is there no multiple inheritance?

565


What is difference between class and object with example?

562


What is class and example?

567






How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1652


What are the 4 pillars of oop?

670


Can bst contain duplicates?

668


to find out the minimum of two integer number of two different classes using friend function

1639


What is destructor give example?

601


What is byval and byref? What are differences between them?

1687


How to call a non virtual function in the derived class by using base class pointer

5255


What are two types of polymorphism?

610


What is the real time example of encapsulation?

595


Why is polymorphism needed?

594