Objects are basic run time entities in an object-oriented system. They may represents person,a place, a bank account a table of data or any item that the program has to handle. They may also represents user defiend data such as vectors, time and lists.
When a program is executed, the objects interect by sending a message to one another.
So what is an object? An object is a component of a program that knows how to perform certain actions and to interact with other pieces of the program.
For examples-:
Let's say that we are writing a text-based medieval video game. Our video game will have two types of characters: the players and the monsters. A player has to know the values of certain attributes: health, strength, and agility. A player must also know what type of weapon and what type of armor they possess. A player must be able to move through a maze, attack a monster, and pick up treasure. So, to design this "player object", we must first separatedata that the player object must know from actions that the player must know how to execute. The definition for a player object could be:
Player Object: data: health strength agility type of weapon type of armor actions: move attack monster get treas
Member Data and Member Functions :-
Data that an object keeps track of is called member data and actions that an object knows how to do are called member functions. Member data is very similar to variables in a regular function in the sense that no other object can get access to that data (unless given permission by the object). Member data keeps its values over the life of an object.