What is public, protected, private?

1 Answer

Answer :

Public, protected and private are three access specifier 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.
Write a function that swaps the values of two integers, using int* as the argument type.  void swap(int* a, int*b) {
int t;
t = *a;
*a = *b;
*b = t;
}

Related questions

Description : Describe PRIVATE, PROTECTED and PUBLIC – the differences and give examples.

Last Answer : class Point2D{ int x; int y; public int color; protected bool pinned; public Point2D() : x(0) , y(0) {} //default (no argument) constructor }; Point2D MyPoint; You cannot directly ... .pinned = true; // Compiler will issue a compile ERROR bool isPinned = MyPoint.pinned; // no problem

Description : Which of the following is not a type of cloud? a) Private b) Public c) Protected d) Hybrid

Last Answer : Protected

Description : Difference between Public, Private, Default and Protected ?

Last Answer : Ans. Private - Not accessible outside object scope. Public - Accessible from anywhere. Default - Accessible from anywhere within same package. Protected - Accessible from object and the sub class objects.

Description : In Java, when we implement an interface method, it must be declared as: (A) Private (B) Protected (C) Public (D) Friend

Last Answer : (C) Public

Description : When the inheritance is private, the private methods in base class are.................. in the derived class (in C++). (A) inaccessible (B) accessible (C) protected (D) public

Last Answer : (A) inaccessible

Description : SHCIL was established in 1986 under the Government of India as __________ A. Private Ltd B. Public Ltd C. Limited Liability Partnership D. Unlimited company E. None of the Above

Last Answer : B. Public Ltd Explanation: Stock Holding Corporation of India Limited(SHCIL) was established in 1986 under the Government of India as public limited company.

Description : ______ is used by public and private enterprises to publish and share financial information with each other and industry analysis across all computer platforms and the Internet. a) Extensible ... Language c) Enterprise Application Integration d) Sales Force Automation Software e) None of these

Last Answer : b) Extensible Business Reporting Language

Description : A ..................is an extension of an enterprise’s private intranet across a public Network such as the Internet across a public Network such as the Internet, creating a secure private connection. A) VNP B) VPN C) VSN D) VSPN

Last Answer : B) VPN

Description : One who disclose information to public of a company, organization, firm, government and private agency and he/she is the member or employee of that organization; such individuals are termed as ___________ a) Sponsored hackers b) Crackers c) Hactivist d) Whistleblowers

Last Answer : d) Whistleblowers

Description : Which of the following best describes the passing of confidential information from a client to its auditor? The information: a. Should in no circumstances be conveyed to third parties. b. Is not ... d. Should be conveyed to the public if it affects the "correctness" of the financial statement

Last Answer : Is not legally protected and can be subpoenaed by a competent cour

Description : Which of the following best describes the passing of confidential information from a client to its auditor? The information: a. Should in no circumstances be conveyed to third parties. b. Is not ... d. Should be conveyed to the public if it affects the "correctness" of the financial statements

Last Answer : Is not legally protected and can be subpoenaed by a competent court.

Description : State true of false. i) Public can only be assigned to class ii) Protected protects a statement iii) Protected method is never accessible outside the package iv) Friendly variable may be accessible outside class A) i- ... -false, ii-true, iii-false, iv-false D) i-true, ii-false, iii-false, iv-true

Last Answer : C) i-false, ii-true, iii-false, iv-false

Description : GCP provides public assurance that a) Rights and safety of participants are protected b) The rights, safety and wellbeing of research participants are protected and that research data are reliable. c) Results are reliable d) Safety of participant is observed and results are reliable

Last Answer : b) The rights, safety and wellbeing of research participants are protected and that research data are reliable.

Description : Explain the following with syntactic rules: (i) public inheritance (ii) protected inheritance.

Last Answer : (i) public inheritance: i) When the visibility-mode is public the base class is publicly inherited. ii) In public inheritance, the public members of the base class become public members of the derived class and ... variables; Member function; }; class B : protected A { Members of class B };

Description : Presentations password protected for opening or modifying can be opened by: a) Power Point Analyzer b) Power Point Viewer c) Power Point Conductor d) None of These

Last Answer : b) Power Point Viewer

Description : Presentations password protected for opening or modifying can be opened by: a) Power Point Analyzer b) Power Point Viewer c) Power Point Conductor d) None of These

Last Answer : b) Power Point Viewer

Description : . From what should the digital data must be protected ? a. Copied b. Deleted c. Modified d. Destroyed

Last Answer : c. Modified

Description : In IT, the method for updating the main memory as soon as a word is removed from the cache is called (1) Write – through (2) Write – back (3) Protected – write (4) Cache – write

Last Answer : Write – back

Description : In the US do we use public school buses to take children to and from religious private schools?

Last Answer : No. Private and religious schools use their own buses. They must have the same sort of equipment, however, to transport children.

Description : What can you tell me about nonprofit status? Specifically, negotiating a public charity vs. private foundation status for a theatre company?

Last Answer : Get a grant writer / 501 ( C ) 3 specialist, I'm in an organization that recently changed to a non-profit. It cost us only $250 for the specialist she collated all of our meeting minutes for many years, ... and it took us 9 months from filing to receive the non-profit status as a 501 ( C ) 3.

Description : Why are private toilet seats often a ring, but public or institutional toilet seats are often a horseshoe?

Last Answer : Dudes can stand up. drip drip drip

Description : Have you ever performed karoake in public and/or private with a favorite song choice?

Last Answer : I finally did it, but it was only in front of a few people at a bar, and most were my friends. I was pretty wasted and finally got the courage. I sang Tomorrow by Silverchair.

Description : What are the rights regarding those who use a public road that resides on private property?

Last Answer : A public road on a neighbor’s private property? That doesn’t make sense to me. Could you explain a little better, please?

Description : Which students are getting the better shake, home schooled students, those in private schools, or those in public schools?

Last Answer : answer:The cons to that would be lack of peer interaction, which might make them awkward in social settings around other kids. No Intramural sports. Maybe limited access to lab setups, etc. ... often with other homeschool kids, and sometimes more often and of more variety than public schooled kids.

Description : Why can't I access (ping) my public IP from within my private network?

Last Answer : hold windows key+r then type cmd press enter Then type ipconfig it should show up. Or are you wondering how to change it?

Description : Where should we draw the line between public and private?

Last Answer : answer:Times have changed @wundayatta and my advice to my kids is nothing is sacred nor private in this day and age. No matter if it was said or done in private anything you say and do can become ... I miss the good old days where gossip was mouth to ear and a secret was held in high regard.

Description : A question of ego, acknowledgment and perspective. Though appreciative, why did I receive many tributes both public and private for the simple effortless task of reaching 5K lurve, but not a single word for reaching 6K lurve?

Last Answer : becase you get an Mariner award and a message in the Community Feed and more people can see the results…its a public milestone… congrats for reaching (6132) lurve

Description : Is there anyway that you can make private previous questions that you had asked (when clicking on your public profile)?

Last Answer : Nope. You can flag them and kindly ask a mod to delete them, but there’s no real way of deleting or hiding your previously asked questions.

Description : What are the advantages and disadvantages of a private versus public school education?

Last Answer : Do you mean college, or are you referring to elementary or high school aged children? If you are talking about the younger folks, I have had both the public and private experience: public school for ... don't have to pay a lot to get a good education, but private school has its benefits.

Description : Does ask-public do an annual rendevous, or meet and greet for the lower caste, or has it always been private invitational only?

Last Answer : ask-public hasn’t done that yet, but if they did, I would participate. I vote for San Francisco for the meeting place.

Description : In your opinion, what information should be kept private and what information can be made public?

Last Answer : Personally, there is a range of what I shared based on how close I am to a person, how many things we have in common, how much I trust them…..And there a few things that I share with no one.

Description : Is it legal to go onto a private lake if you can float into it from a public river?

Last Answer : Using the Arkansas Code, it appears that this would be illegal, and would be trespassing in the third degree. Anybody who enters or remains unlawfully in or upon premises is guilty of this crime, and I could ... Perhaps there are some that I couldn't find, but from what I see there, it's illegal.

Description : What does personal mean to you, and how do you define for yourself what you keep private and what you make public?

Last Answer : By checking or un-checking a tickmark on Facebook.

Description : Do you think school uniforms should be mandatory in schools, both private and public?

Last Answer : My wife (a teacher) and I don't see eye to eye on this. She likes school uniforms as she claims it helps with school discipline. Although I believe that that is important, I feel that by ... acceptable and what isn't. I am thankful that the school my third grader attends does not have uniforms.

Description : What is the difference between a public sector industry and one which is in the private sector ? -Geography

Last Answer : Public Sector Industries are owned and managed by the Central or State Government such as Railways, Post and Telegraph, Heavy Engineering, Defence Establishment etc. Private Sector industries are owned and ... an individual or group of individuals such as Reliance India Ltd., Infosys, Wipro etc.

Description : 18. Using examples from your area compare and contrast that activities and functions of private and public sectors. -SST 10th

Last Answer : In the private sector, the assets and industries are owned by individuals and in the public sectors industries and enterprises are owned by the Government. Private sector works to earn profits and the ... private sector that we can see around us are IT companies, malls and multiplexes, etc.

Description : Distinguish between Public sector and Private sector? -SST 10th

Last Answer : Public sector: 1.It is controlled and managed by the government. 2.The main aim of the sector is public welfare. 3.The sector provides basic facilities like education, health, food and security ... sector does not provide any service at a reasonable rate. For example: Tatas, Birlas, Reliance.

Description : On what basis is the industrial sector classified into public and private sectors ? -SST 10th

Last Answer : C - Industries in the public sector are owned by the government while those in the private sector are owned by entrepreneurs.

Description : Differentiate between the public sector and private sector by giving examples. -SST 10th

Last Answer : In the public sector, the government owns most of the assets and provides all the services. In the private sector, ownership of assets and delivery of services is in the hands of private ... Iron and Steel Company Limited (TISCO) and Reliance Industries Limited (RIL) are in private sector.

Description : Using examples from your area, compare and contrast the activities and functions of the private and public sectors. -SST 10th

Last Answer : This answer was deleted by our moderators...

Description : Using examples from your area, compare and contrast the activities and functions of the private and public sectors. -SST 10th

Last Answer : Public Sector : There are the organisations which directly or indirectly come under the control of government, like MTNL, railways, Indian Airlines etc. Private Sector : In private sector organisations ... the motive of earning profits. BSES and Sahara Airlines are the examples of private sector.

Description : On what basis is the industrial sector classified into public and private sectors? -SST 10th

Last Answer : The industrial sector is classified into public and private sectors on the basis of ownerships of enterprises.

Description : How far is it correct to say that several services which cannot be provided by private sector can be provided by the public sector ? -SST 10th

Last Answer : Society needs many things as a whole which the private sector is not able to provide at a reasonable cost. The reasons are as follows : (i) Some of them need spending large sums of ... care of ignored and backward regions of the country to bring balanced growth, development in the entire country.

Description : What is the difference between a public sector industry and one which is in the private sector? -SST 10th

Last Answer : Public Sector Private Section Public sector industries are owned and controlled by the Central or State Governments e.g. iron and steel, aircraft, petroleum refineries. Private sector industries ... industrialists as joint stock companies or proprietary concerns e.g. cement, paper, textiles.

Description : What is the difference between public budget and private budget ?

Last Answer : The public budget is for the country and the private budget is for the family.

Description : What is the standard difference between private and public polytechnics ?

Last Answer : Many people say that it is easy to get a job if you pass from government and it is difficult to get a job if you pass from private. That is completely wrong. The company will hire you , ... in quality between public and private polytechnics. If you study well, you can come up from any place.

Description : What is the difference between private and public universities ?

Last Answer : Universities which are usually primarily funded by the government of a country are called public universities. Private universities, on the other hand, do not usually receive financial benefits from ... In many countries, public universities are better in terms of teaching and research activities.

Last Answer : 58 in Bangladesh Public Private University There is

Description : Which do you think is better?

Last Answer : They may work more painlessly in private, or they may be more likely to remedy the situation than to stop it immediately. A concrete example is that a friend was extracted his teeth in a public place ... a private clinic. And the big difference is that you pay in private. But care is also better.

Description : Private Sector and Public Sector.

Last Answer : Distinguish between: Private Sector and Public Sector.