Straight Shooter What's Your attributes?


My ma always said my straight shootin' was my very best attribute. Well...ok, that's not entirely true...but it does illustrate something about what 'attribute' means. For people, an attribute is a quality they 'have'. For objects, an attribute is something that it 'is'.

The great thing about attributes in object oriented programming is that they allow you to check the functions that are taking place. If an object 'is' something, we can check for that, and ensure it is working properly. This is particularly important in object oriented programming, because the data controls the software to a great extent (where as in procedural programming the data has no control at all).

In object oriented programming two attributes, storage class and type are used as 'identifiers'. Together these attributes allow data to be checked for correct functioning.

Attributes are an aspect of object oriented programming that are given a great deal of emphasis in  c++  and some other object oriented languages. Each object oriented program uses a different method for determining attributes. (For instance, the c++ compiler deduces these attributes from implicit or explicit declarations in the source code). 

The main things to remember are:

1)    Different object oriented programs use a different method for determining attributes.

2)    Attributes allow checking of functions to take place.

3)    The are two prime attributes:      a)    Storage Class     b)     Type

Here is a practical example

You know that pages are the basic documents of the World Wide Web. They are written in an evolving language called HTML (Hypertext Mark-up Language). An HTML page contains text and HTML tags — embedded commands that supply information about the page's structure, appearance, and contents.

Some HTML tags build a description of the structure of the elements on a page, such as tables and forms, which are made up of many elements. Web browsers (programs that display pages) use this information to determine how to display the page elements in relation to each other. For example, the HTML tags that describe a table specify the number of rows it has, the number of cells in a row, and so forth.

In addition to describing the structure of page elements, some HTML tags also contain attributes. Attributes provide details about a particular tag. For instance, the tag that inserts an image on a page has an attribute that supplies the name of the image to insert. Some attributes supply preferences about the layout of the page element. For example, a table has attributes that describe its border width and the padding between its cells.

Back To Top

Storage class on the other hand dictates the location (data segment, register, heap, or stack) of the object and its duration or lifetime (the entire running time of the program, or during execution of some blocks of code). Storage class can be established by the syntax of the declaration, by its placement in the source code, or by both.

The type determines how much memory is allocated to an object and how the program will interpret the bit patterns found in the objects storage allocation. A given data type can be viewed as the set of values (often implementation-dependent) that identifiers of that type can assume, together with the set of operators allowed on those values.

To read more about classes and type,
click here


Back To Top



Visit An Area In OzEdweb

Technophile_City_(INFOTECH)The_Time_Machine_(HISTORY)  |  The_Tree_House_(SOSE)Lessons_Index   |  Assessment_Instruments  |  Maps   |  Power Point   |  Proforma  |  Links  |  Gallery  |  Games  |  Humour   |  Prizes  |  WebRings  |  Soapbox  |  Search_Engines  |  Site_ Map_ |


             Search OzEdweb By Keyword