What are the differences between public, private, and
protected access?
Answers were Sorted based on User's Feedback
Answer / koushik k reddy
Private:
It cannot be accessed by object and cannot be inherited, will be used only by the member functions of the class
Protected:
It cannot be accessed by the object and used by the member functions of the class can be inherited to first level of inheritance
Public:
It can be accessed by the objects and can be inherited to any level
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kalpana.y
Private is used for intialization of variables
eg:
int p,r;
public is used for function name
eg:
void display();
protected is used for void main()
eg:
void main()
class c;
Is This Answer Correct ? | 24 Yes | 86 No |
What is the use of setprecision in c++?
What are templates? where we should use it?
What does namespace mean in c++?
What it is and how it might be called (2 methods).
How would you stop a class from class from being derived or inherited?The constructer should not be Private,as object instantiation should be allowed.
What is implicit conversion/coercion in c++?
What is the maximum value of a unsigned char a) 255 b) 256 c) 128
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
Why do we use pointers in c++?
write the prime no program in c++?
Explain how an exception handler is defined and invoked in a Program.
Which is better c++ or java?