Everything2
Near Matches
Ignore Exact
Full Text
Everything2

public

created by mg

(idea) by moa (2.5 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 (1.7 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
Just another sprinkling of indeterminacy
In his autumn before the winter comes man's last mad surge of youth
Sunset Boulevard
The threat of freedom
I signed up for the carpool for all the wrong reasons and now I'm bitter as Hell
The Truth Behind Doritos Flavors
Japanese education
learning to juggle
Gone in Sixty Seconds 2006 - Theatre Quest Entries
If we could build things out of concepts, I'd have pants made of lust
Les Fleurs du Mal
Stormy Weather
Active Denial System
Pioneer 10
New Writeups
SubSane
Making Love to a 9-Foot Woman(person)
Ouzo
Thoughts(idea)
antigravpussy
I fall silent, listening. The breadcrumbs are talking about us(person)
calgon
Buffalo Bill by the pool(poetry)
gate
Anarchy is Order(idea)
ushdfgakjasgh
Scribeling(thing)
XWiz
Trism(review)
artman2003
Briefcase Full of Souls - Part I(fiction)
Dreamvirus
Alan Ladd(person)
waverider37
Harold Holt(person)
The Debutante
Until death do us part(fiction)
Ysardo
a brother to a sister(personal)
antigravpussy
your warm whispers(personal)
Clarke
Multiculturalism(idea)
aneurin
Earl of Landaff(person)
This page courtesy of The Everything Development Company