answersLogoWhite

0

"public" means that objects can access this member/method from outside of the class that it was declared in. This is the opposite of "private", which means that only methods in the declaring class can access this object, and "protected" which means that this member/method is private except for subclasses, which see it as public.

For example:

class Shape{

private area; // Only methods in the "Shape" class can access this variable

public getArea{return area}; // This is legal because it is in the Shape class

protected setArea(int x){area = x};

};

class Circle : Shape{ // Circle is a subclass of Shape and inherits its members & methods

public randomFunction{area = 7;} // ILLEGAL, area (which belongs to "Shape" is private

public randomFunction2{return getArea()}; // LEGAL, getArea is public

public randomFunction3{setArea(7)}; // LEGAL, because we inherit from Shape

};

See also: encapsulation

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What was the first Microsoft apple computer named?

Microsoft and Apple worked together on making a BASIC programming language call AppleSOFT, Microsoft created the Z40 for the Apple II the follow on of the Apple I the first ever public Computer!


What was the name of the first programming language devoloped in the third generation of computers?

The 3rd generation of computer started in 1964, which was the year BASIC appeared to public the first time. Disclaimer: There may be other programming languages came out in 1964 but earlier than BASIC.


What has the author Peter Vollenweider written?

Peter Vollenweider has written: 'Encapsulated postscript' -- subject(s): Microcomputers, PostScript (Computer program language), Programming 'Stichprobentheorie in Publizistik und Kommunikationsforschung' -- subject(s): Mass media, Public opinion, Public opinion polls, Sampling (Statistics)


Where can you find a guide to one of the more basic computer programming languages for free?

Visual basic is a pretty basic language and you can get it for free from Microsoft. Download it at http://www.microsoft.com/express/vb/default.aspxMost public libraries will have books about various popular programming languages. You can also find manuals, guides, specifications, tutorials, and support for many, many computer languages by searching the internet.


Where can one get a book on Socket Programming in C?

You can typically find books on Socket Programming in C at major online retailers like Amazon or through specialty bookstores that focus on technical or programming topics. Additionally, many public and university libraries may have copies available to borrow.


Write a program in java programming language to print welcome to java programming?

public class welcome { public static void main (String args[]) { System.out.println("Welcome to Java programming"); } } There are also many "Hello World" tutorials you can find elsewhere on the internet


What is the major difference between public and private access method in computer programming?

public means this can be accessed from any class private means this can be accessed only from the current class


Which colleges offer the best computer science majors?

Any public college in your state should offer you a good computer programming degree. These schools are funded by the state , so they should have quality programs.


What does open source mean?

"Open source" means it is written in or related to a type of computer programming code that is available to the public. See related links for details.


What is the meaning of remote host in computer?

a computer that resides in some distant location from which data can be retrieved .It typially refers to a server in a private network or public network.


What companies produce computer inventory management software?

GFI MAX, Manage Engine, GigaTrak are just a few computer inventory management software available to the general public. You could also have a program made custom by contacting a programmer or a computer programming company.


Which unit of class gets called when object of class is created?

The details may depend on the programming language, but it is typical that when an object is created, the so-called "constructor" is called.