answersLogoWhite

0


Best Answer

There are 2 ways: "private or protected" and "public". A programmer has the choice of making the object's data either protected or public. Protected means the data associated with that object can be only accessed by the object's own methods. It can't be globally accessed by simply calling the variable. Public means it can be accessed from any function. E.g: Class Person { Protected: Char name; Char hair-colour; change haircolour change name The above class can have an object of person with his name and hair-colour. As you can see it is protected and no one else can change them except your own functions of change hair-colour and change name. That's how data and methods are organized. It is a security feature, called data encapsulation.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

You should try and design classes so that they represent real world entities. Once you have the correct granularilty, any data associated with the entity should be added. If you are using Java, then the data should be represented as private members. The most critical data members should also be added as arguments to the constructor so that when an instance is created the data is supplied by the caller. For example, if you are creating an Employee class, you may add employee ID and name as arguments to the constructor. The rest of the data can be set via a series of set methods (one per property). You should also add ge method for all properties.

Now you can proceed to encapsulate the behavior. Most methods alter the state of the object (for example add a Dependent to an Employee object).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How are data and method organized in an object oriented program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the features of object oriented program?

The features of object oriented programming are Abstraction, Encapsulation, Polymorphism & Inheritance


What is novell's object-oriented database organized as a hierarchical tree?

edirectory


Why we are specifying C programming as structure oriented program?

Hint. Is not object oriented.


Is c an object oriented programing language?

C language is not a program, and it isn't an object-oriented language either.


Is the high-level language is also an object oriented program?

Not necessarily. Any language with an object-oriented approach will be a high-level language, but a high-level language does not have to use an object-oriented approach.


Is c plus plus is pure object oriented?

No. C is not object-oriented, it is a procedural language.C++, while object-oriented, is not purelyobject-oriented. One of the requirements for a pure object-oriented language is that everything is an object. C++ still has primitive data types (int, long, double, etc.), and so is not purely object-oriented.


What is AOP?

AOP or Aspect oriented Programming is A paradigm in Computer Science. In traditional object-oriented programming, common code like logging, exception handling scattered all across method, classes, object hierarchies, or even entire object models. so Aspect oriented programming is a technique to separate these concerns from real problem domain and increase modularity and reusability of program


What is Objectives Oriented Evaluation Approach to program evaluation?

Objectives Oriented Evaluation Approach is the means by which the worth or merit of a program is assessed based on the extent to which the objectives or purposes of the program are being achieved.


What is the difference between function and method in c language?

In object-oriented languages, a class member function is also known as a method. C does not provide native support for the object-oriented paradigm and therefore does not support methods.


What is the components of OOPS?

Java is an object oriented programming language. The various object oriented concepts in it are: * Class * Object * Instance * Method * Inheritance * Polymorphism * Abstraction * Encapsulation etc...


What has the author Stephen Gilbert written?

Stephen Gilbert has written: 'Object-oriented design in Java' -- subject(s): Java (Computer program language), Objektorientierte Programmierung, Java (Programmiersprache), CD-ROM, Systementwurf, Object-oriented programming (Computer science) 'Object-oriented design in Java' -- subject(s): Java (Computer program language), Object-oriented programming (Computer science)


What does object oriented and procedural mean in programming language?

procedure oriented means program will be execte in step by step procedure,when comes to object oriented means every thin can be represents the object a step[ step procedure doesnot follow