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

1 Answer

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 access private data members when they are declared (implicitly)  private:  
MyPoint.x = 5; // Compiler will issue a compile ERROR
//Nor yoy can see them:
int x_dim = MyPoint.x; // Compiler will issue a compile ERROR
On the other hand, you can assign and read the public data members:  
MyPoint.color = 255; // no problem
int col = MyPoint.color; // no problem
With protected data members you can read them but not write them: MyPoint.pinned =  true; // Compiler will issue a compile ERROR  
bool isPinned = MyPoint.pinned; // no problem

Related questions

Description : What is public, protected, private?

Last 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 ... *b) { int t; t = *a; *a = *b; *b = t; }

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 : 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 : 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 : 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 : Give examples to prove that social differences cross-cut each other. -SST 10th

Last Answer : . If social differences cross-cut one another, it is difficult to put one group of people against the other. . It means the groups that share a common interest on one issue are likely to be ... do not do so in the Netherlands. That's why cross-cutting social differences are easier to accommodate

Description : Give examples to prove that social differences cross cut each other.What is the difference between cross-cutting and over-lapping? -SST 10th

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

Description : What are called private sector industries? Give examples. -SST 10th

Last Answer : Private sector industries are owned and operated by individuals or a group of individuals. Examples — TISCO, Bajaj Auto Ltd., etc.

Description : What are the differences between federal student loans and private?

Last Answer : Federal student loans have a feature where you can pay them back after you graduate school and get a job, while private loans make you pay for them while you are going to school, you should try to get a grant first before applying for any loan, because of the interest rates. www.finaid.org

Description : Describe how communities have conserved and protected forests and wildlife in India. -SST 10th

Last Answer : (i) In Sariska Tiger Reserve : Rajasthani villagers have fought against mining by citing the Wildlife Protection Act. In many areas, villagers themselves are protecting habitats and ... economic or developmental activities, that are people centric, environment-friendly and economically rewarding.

Description : Answer the following questions in about 120 words. Describe how communities have conserved and protected forests and wildlife in India. -SST 10th

Last Answer : The forests in India are home to a number of communities. These communities share a complex relationship with the flora and fauna around them. In certain areas, local communities are ... examples to create the involvement of local communities in the management and restoration of degraded forests.

Description : Describe how communities have conserved and protected forests and wildlife in India? -Geography

Last Answer : In India many traditional communities still live in the forests and depend on their livelihood for forest produce. These communities are working hand in hand with the government to conserve ... communities in protecting the environment, and stopping degradation of forests has reaped many benefits.

Description : Describe the accessibility modifier “protected internal”. 

Last Answer : It is available to classes that are within the same assembly and derived from the specified base class.

Description : Describe the accessibility modifier “protected internal”. 

Last Answer : It is available to classes that are within the same assembly and derived from the specified base class.

Description : Describe the accessibility modifier protected internal. 

Last Answer : It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in). 

Description : Describe use of protected access specifier used in the class.

Last Answer : Protected access specifier is use to declare a class member that is accessible by the member functions within its class and any class immediately derived from it.

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 : Look at these differences in speech, and convention, a century has done... do you have other examples?

Last Answer : answer:I think it would offend… What would? The writing style?

Description : Taking the examples at Carlos, Smith and Norman, explain how social differences divide similar people from one another but also unite very different people ? -SST 10th

Last Answer : (i) Similarity between Tommie Smith and John Carlos : Both Tommie Smith and John Carlos were African-Americans. They both were Blacks and were facing racial discrimination in the United States. ... were united on the issue of racial discrimination though one of them belonged to white class.

Description : Explain the two basis of social differences with examples. -SST 10th

Last Answer : Different forms of social differences: (i) Social differences are based on accident of birth. E.g., people around us are male and female, they are tall and short, have different kind of ... any religion. Some people choose to follow a religion other than the one in which they were born.

Description : Which of these statements apply to Strategic Groups. A. Organizations within an industry following similar strategies or competing on similar bases. B. Examples, in grocery retailing are supermarkets ... the similarities and differences in bases of segmentation D. All of these options apply

Last Answer : All of these options apply

Description : Which of these statements apply to Strategic Groups. A. Organizations within an industry following similar strategies or competing on similar bases. B. Examples, in grocery retailing are supermarkets, ... the similarities and differences in bases of segmentation D. All of these options apply.

Last Answer : All of these options apply.

Description : Who could have said this - i fear that if we give too much power to the federal government then the states and people of those states will not be protected?

Last Answer : Patrick Henry said this.

Description : saving some private time for yourself and learning to 'pigeonhole' problems are two examples of -General Knowledge

Last Answer : Saving some private time for yourself and learning to 'pigeonhole' problems are two examples of renewing your attitude through daily activities.

Description : Prisons, military camps, private boarding schools, are examples of social institution.

Last Answer : Correct the underlined words and complete the sentence : Prisons, military camps, private boarding schools, are examples of social institution.

Description : 20. Give a few examples of public sector activities and explain why the government has taken them up. -SST 10th

Last Answer : Example of credit as an asset: During the festival season, a shoe manufacturer has received an - order of making shoes in bulk, within a month's time. To complete production, he hired some ... whereas in farmer's case credit pushes the borrower into a situation from which recovery is very painful.

Description : Give a few examples of public sector activities and explain why the government has taken them up. -SST 10th

Last Answer : Construction of roads, bridges, railways, harbours, generating electricity, providing irrigation through dams, health, education etc. are a few examples of public sector activities Government has taken up these ... these industries can afford. So the government has to bear a part of the cost.

Description : What is meant by public sector industry? Give examples. -SST 10th

Last Answer : Public sector industries are owned and operated by government agencies.Example — BHEL, SAIL, etc.

Description : What are the differences between ‘sectional interest groups’ and ‘public interest groups’. -SST 10th

Last Answer : Sectional Interest Groups A section of society: Workers, employees, businesspersons, industrialists, followers of a religion, caste groups, etc.Their principal concern is the betterment and ... short.The Nepalese Democratic Movement and Narmada Bachao Andolan are some examples of movement groups.

Description : Define what are the differences between static, public and void in C#?

Last Answer : 1. Static classes/methods/variables are accessible throughout the application without creating an instance. The compiler will store the method address as an entry point. 2. Public methods or variables are accessible ... 3. The void is used for the methods to indicate it will not return any value.

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.