Everything2
Near Matches
Ignore Exact
Full Text
Everything2

public

created by mg

(idea) by moa (2.6 mon) (print)   ?   (I like it!) Fri Aug 04 2000 at 0:49:21

In C++, this optional keyword starts declaring the public data members and/or member functions. The public members of a class are highly accessible by other program parts.

It is invoked thus:

class foo
{
public:
public data members
public member functions

protected:
//
private:
//
}

The public section tells the compiler that the data members and member functions are accessible to everything. ALL functions in the program can access public methods and data whether they are instances of the class, descendants, or neither.


(thing) by ariels (2.8 d) (print)   ?   (I like it!) Mon Sep 02 2002 at 17:36:34

C++ class member visibility:

In C++, members of the "public:" section(s) of a class (or struct) definition are visible wherever that class is visible. The public members of the class form its interface to the external world.

One cannot illustrate the behaviour of public: with code snippets, as all accesses tend to be legal. For (non-)examples of things that fail with private:, see that node's writeup.

By default, classes have some predefined members; these members are public members. The default constructor, default copy constructor, operator=, and are all public members. If you wish, you can put them explicitly in some other section -- but then you lose the default definition, and must define them yourself if you use them. Declaring an unused default member private:, and never defining it, is a good way to "delete" that member.

The default visibility of a struct is public:.

C++ inheritance visibility:

You may also specify inheritance as public. Public inheritance means that the inheritance relationship is "in plain sight" for all to use. Of course, publically inheriting from another class keeps all visibility restrictions of the original class -- private: and protected: members do not suddenly become visible in the inheriting class!

Public inheritance matches what is usually considered the "is-a" relationship; it is the form most commonly used.


(definition) by Webster 1913 (print) Wed Dec 22 1999 at 2:21:03

Pub"lic (?), a. [L. publicus, poblicus, fr. populus people: cf. F. public. See People.]

1.

Of or pertaining to the people; belonging to the people; relating to, or affecting, a nation, state, or community; -- opposed to private; as, the public treasury.

To the public good Private respects must yield. Milton.

He [Alexander Hamilton] touched the dead corpse of the public credit, and it sprung upon its feet. D. Webster.

2.

Open to the knowledge or view of all; general; common; notorious; as, public report; public scandal.

Joseph, . . . not willing to make her a public example, was minded to put her away privily. Matt. i. 19.

3.

Open to common or general use; as, a public road; a public house.

"The public street."

Shak.

Public actstatute Law, an act or statute affecting matters of public concern. Of such statutes the courts take judicial notice. -- Public credit. See under Credit. -- Public funds. See Fund, 3. -- Public house, an inn, or house of entertainment. -- Public law. (a) See International law, under International. (b) A public act or statute. -- Public nuisance. Law See under Nuisance. -- Public orator. Eng. Universities See Orator, 3. -- Public stores, military and naval stores, equipments, etc. -- Public works, all fixed works built by civil engineers for public use, as railways, docks, canals, etc.; but strictly, military and civil engineering works constructed at the public cost.

 

© Webster 1913.


Pub"lic, n.

1.

The general body of mankind, or of a nation, state, or community; the people, indefinitely; as, the American public; also, a particular body or aggregation of people; as, an author's public.

The public is more disposed to censure than to praise. Addison.

2.

A public house; an inn.

[Scot.]

Sir W. Scott.

In public, openly; before an audience or the people at large; not in private or secrecy. "We are to speak in public."

Shak.

 

© Webster 1913.


printable version
chaos

usenet mixed economy bad password private
Kids in the Hall sex survey Victoria's Secret protected
Beepage Pierre Paul Royer-Collard accessor bean
Open Container Law ducking stool topfree Smart shoes
Liberal Democracy static Donal MacIntyre picnic table
Outsider group Holder-forth Secret Honor The Atomic Cafe
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Drink up!
E2 is unfriendly to old noders
The Great Wall of China
Slaughterhouse tour, or Why I'm no longer a lawyer
Quaternion
George S. Patton
LeVar Burton
a method for everything
Guessing the worth of something
Nodose
Hellcat
Quieting a crying baby
ten grave precepts
James Burke
New Writeups
antigravpussy
One fly amongst many(person)
sam512
Moon Base Shackleton, 1978(fiction)
Pavlovna
toy boy(person)
XWiz
tear jerker(review)
Heitah
Anarchy is Order(idea)
jessicaj
July 26, 2008(dream)
Berek
ABBA(person)
devolution
k-hole(place)
Nadine_2
The Sound Of Madness(review)
SwimmingMonkey
Conversations with Fo Fo, the Loneliest dog in Purgatory(fiction)
locke baron
lynx(thing)
Simulacron3
Reality, Dimensions and the Natural Ontology(essay)
SubSane
Making Love to a 9-Foot Woman(person)
Ouzo
Thoughts(idea)
antigravpussy
I fall silent, listening. The breadcrumbs are talking about us(person)
E2 is a by-product of the existence of The Everything Development Company