Search This Blog

Thursday, 20 December 2012

Objects

objects are the basic run-time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle, They may also represent user-defined data such as vectors, time and lists. Programming problem is analyzed in terms of objects and the nature of communication between them, Program objects should be chosen such that they match closely with the real-world objects, Objects take up space in the memory and have an associated address like a record in Pascal, or a structure in C.
  
  When a program is executed, the objects interact by sending messages to one another. For example, if "customer" and "account" are two objects in a program, then the customer object may send a message to the account object requesting for the bank balance. Each object contains data, and code to manipulate the data. Objects can interact without having to know details of each other's data or code. It is sufficient to know the type of message accepted, and the type of response returned by the objects. Although different authors represent them differently, shows two notations that are popularly used in object-oriented analysis and design.



Object using c++


#include<iostream.h>
#include<conio.h>
class person
{
public:
void show()
{
cout<<"this is class function"<<endl;
}
};
void main()
{
person p;
p.show();
}
getch();
}


Output:
this is class function




No comments:

Post a Comment