answersLogoWhite

0


Best Answer

This is called "encapsulation", and there are two main reasons. (1) To be able to change the internals of the class at any time, without breaking compatibility with programs that use the class. (2) To be able to do some processing on any data that goes in or out of the class. For example, when assigning a value to a field (attribute), it is possible to check whether the parameter is within the allowed range of values.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why are attributes of a class usually hidden from other users?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How can a variable be characterized?

name, type, storage class, other attributes (const, volatile), value, address


What are attributes and methods in class?

Attributes are the class member variables, the data, fields or other properties that define the class state. Methods are the functions of a class, the operations that define its behaviour, typically working in conjunction with the class member attributes to either alter the class state (mutators) or query the class state (accessors). Special methods such as the class constructors, its destructor and conversion operators are invoked indirectly through compiler-generated code while all others are called directly via programmer-generated code.


Can additional methods of base class be hidden from the derived class in object oriented software?

Yes. During inheritance only the public members of the parent class are visible to the child class. If you declare a method or a variable as private, the child class cannot access it. In other words, the methods and variables are hidden from the derived class.


What are the attributes goes with the h1 tag?

In HTML 5, the <h1> element may have the attributes "class" and "style". In older versions of HTML (such as 4.01), other attributes such as "align" were supported, but these have been deprecated and removed in HTML 5 in favor of CSS.


What are two items that are usually mentioned on a syllabus?

One item mentioned on a syllabus is the particular class schedule that denotes what will be studied and when. The other item usually on a syllabus is a list of books that will help a student understand the concept of the class.

Related questions

What is meant by inheritance in c plus plus language?

Inheritance in C++ and in other Object Oriented languages is the creation of a class that incorporates a different class. The child (or derived) class "inherits" all of the elements (attributes and methods) of the parent (or base) class. Depending on the design of the base class, the derived class can use methods and attributes of the base class as if they were its own. Typically, however, attributes of the base class are private to the base class and inaccessible to the derived class so as to maintain class hierarchy and data encapsulation.


How can a variable be characterized?

name, type, storage class, other attributes (const, volatile), value, address


What is hidden file how they are create in unix?

A hidden file in Unix is any file that starts with a '.' in the name. Any utility that creates files can create a hidden file. Note: it is important to know that a hidden file is usually one that doesn't need to be shown in a directory listing all the time so unless you use the special option to show them they won't show up in a listing. Other than that, they have no special attributes.


What are attributes and methods in class?

Attributes are the class member variables, the data, fields or other properties that define the class state. Methods are the functions of a class, the operations that define its behaviour, typically working in conjunction with the class member attributes to either alter the class state (mutators) or query the class state (accessors). Special methods such as the class constructors, its destructor and conversion operators are invoked indirectly through compiler-generated code while all others are called directly via programmer-generated code.


Can additional methods of base class be hidden from the derived class in object oriented software?

Yes. During inheritance only the public members of the parent class are visible to the child class. If you declare a method or a variable as private, the child class cannot access it. In other words, the methods and variables are hidden from the derived class.


What are the attributes goes with the h1 tag?

In HTML 5, the <h1> element may have the attributes "class" and "style". In older versions of HTML (such as 4.01), other attributes such as "align" were supported, but these have been deprecated and removed in HTML 5 in favor of CSS.


What is the schema master?

schema Master All databases have a schema which is a formal definition (set of rules) which govern the database structure and types of objects and attributes which can be contained in the database. The schema contains a list of all classes and attributes in the forest. The schema keeps track of: * Classes * Class attributes * Class relationships such as subclasses (Child classes that inherit attributes from the super class) and super classes (Parent classes). * Object relationships such as what objects are contained by other objects or what objects contain other objects. There is a class Schema object for each class in the Active Directory database. For each object attribute in the database, there is an attributeSchema object. Schem Master is A FSMO role held by single DC in forest


Was there a lower class?

Yes there was a lower class it usually consisted of slaves, and other people like the slaves


What are the attributes of a pyramid?

A pyramid has a based that is a polygon such as a triangle or rectangle. The other sides of a pyramid consist of triangles, which are usually the same size.


What is an anthropomorphist?

An anthropomorphist is a person who attributes the human form or other human attributes to God.


How do you become hidden on Build-a-Bearville?

you are not hidden. lets say your in bear university hidden are people in other places you are not hidden. lets say your in bear university hidden are people in other places


What is a class and object of a class?

A class (public) holds objects and methods (actions that can be imported and used by other objects and classes. An object is a thing that holds behavior and attributes. For example, take the scientific group of Mammal. This would be a class. Dogs, cats, 60 Minutes cohost Morley Safer, and Wooly Mammoths are all objects inside the class Mammal.