answersLogoWhite

0

Public, protected and private accessors only apply to code outside of the class. Instances of a class (objects) have complete and unrestricted access to all their own instance variables (data members). They also have unrestricted access to the instance members of all other instances of the same class whenever those instances are passed as arguments to a class member method. Static methods of the class have the same privilege, as do friends of the class.

So the question isn't why an object can access its own public members without using an operator or member function. Any code outside of the class has that exact same right, but if an object has unrestricted access to its protected and private members, why should its public members be treated any differently?

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

Why was java developed and what is the purpose of this programming language?

It is object oriented language in which All program is to be written inside a specific class. it is more comfortable and less coding required to build program.


What are the basic components of a program?

The main 2 components of any program in general are... 1> Program code (any programming language) 2> Data (numbers/text/graphics) The programming language uses code to manipulate: store/calculate/interrogate/display the data. The data could, in fact, be located anywhere... -inside of the program's own 'internal' structure such as: data statements/array structure/variables list/-etc. -or else, inside of an 'external' database file: (.txt)/(.dat)/(.csv)/-etc.


Why is C plus plus called an object oriented programming language?

Any language that supports class types, private and protected data, inheritance, polymorphism, function overriding, virtual methods is regarded as an object oriented programming language. However, while C++ supports OOP, it does not rely on it. You can mix C++ and C-style code (non-OOP) in the same program.


Why is it good advice to indent all the statements inside a set of braces in java programming?

it is necessary to indent all the statements inside a set of braces so that the compiler can know what & when to be compiled.An opening braces indicates that a new process has created & closing braces indicates that the process is getting terminated at that point.


IN which Programming language flash mx is written?

Flash MX uses ActionScript for its language. It controls the movies and the items inside the movies. ActionScript is similar to JavaScript, if you are familiar with JavaScript.

Related Questions

Why was java developed and what is the purpose of this programming language?

It is object oriented language in which All program is to be written inside a specific class. it is more comfortable and less coding required to build program.


What are the basic components of programming?

The main 2 components of any program in general are... 1> Program code (any programming language) 2> Data (numbers/text/graphics) The programming language uses code to manipulate: store/calculate/interrogate/display the data. The data could, in fact, be located anywhere... -inside of the program's own 'internal' structure such as: data statements/array structure/variables list/-etc. -or else, inside of an 'external' database file: (.txt)/(.dat)/(.csv)/-etc.


What has the author Wilf R LaLonde written?

Wilf R. LaLonde has written: 'Inside Smalltalk' -- subject(s): Smalltalk (Computer program language), Smalltalk-80 (Computer system), Object-oriented programming


What are the basic components of a program?

The main 2 components of any program in general are... 1> Program code (any programming language) 2> Data (numbers/text/graphics) The programming language uses code to manipulate: store/calculate/interrogate/display the data. The data could, in fact, be located anywhere... -inside of the program's own 'internal' structure such as: data statements/array structure/variables list/-etc. -or else, inside of an 'external' database file: (.txt)/(.dat)/(.csv)/-etc.


What is the c language used in microprocessor?

The program used inside microprocessors is microcode,the program what microprocessors execute is machine code.


Is ruby a native programming language?

No, Ruby is an interpreted language; it is not directly compiled to machine code, but instead is executed inside a virtual environment (the Ruby Runtime Environment).


What is the difference between abap and sap?

SAP is a Complete Enterprise Resource Planning Package where as ABAP is the programming language used by SAP to write the code inside the SAP system. ABAP is a programming language used for the development & customization works in SAP ERP.


What is the purpose of public in java programming?

Public, Protected, and Private specify what has access to a routine or variable. Public is the most generous, meaning that variable or routine can be accessed from both inside and outside that program. Protected means that the variable or routine can be accessed broadly within the program, but not from outside. private means that variable or routine is only accessible to routine it is part of.


Why is C plus plus called an object oriented programming language?

Any language that supports class types, private and protected data, inheritance, polymorphism, function overriding, virtual methods is regarded as an object oriented programming language. However, while C++ supports OOP, it does not rely on it. You can mix C++ and C-style code (non-OOP) in the same program.


Why it is necessary to avoid infinite loops in program design in C programming?

Infinite loops in any programming language are infinite. As in, they don't stop, unless they are told so somewhere INSIDE the loop. If a loop is allowed to continue infinitely (e.g while(true){} is a valid, truly infinite loop), they will hang up (freeze) the program, or even the computer running it, eating excessive resources, and requiring your user to manually terminate (sigterm, sigkill, task manager, alt+f4) the process.


What is the name of the curves Adobe Systems used to define shapes in its Postscript programming language?

PostScript is the programming language developed by Adobe Systems to define shapes in outline with lines and curves called Bezier curves. ....create a separate font folder, inside the system font folder, and file each font by its name


To Start Making Software?

If you're someone who is interested in making software, you need to know the proper programming languages inside out. On top of that, you need to constantly be learning, because like a foreign language, if you don't program in a certain language for a while, you'll become rather rusty. So it helps if you're constantly using the right computer programming languages for your work projects and your own personal projects. Keep writing code and improving your craft, and eventually you can make your own software to sell or distribute for free.