Solved

How C++ objects Communicate to each other

Posted on 2006-06-18
6
521 Views
Last Modified: 2012-06-27
Hi experts!

In many of the books i have read describe that " C++ objects communicate each other",and this concept is the one which confuses me most.

Can anybody explain me How this communication between objects is done with "theoriotical" and "code example"
or else give me link which expalins me about this concept


Thanks in advance
-Shanti
 


 
0
Comment
Question by:shanti_priya
  • 5
6 Comments
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16932070
Theoratically Objects communicate with each other by passing message.
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16932071
Pratically they communicate with each other by calling member functions.
0
 
LVL 12

Accepted Solution

by:
rajeev_devin earned 125 total points
ID: 16932085
Example:

class Door
{
public:
   open(); // message to open the door.
};

class Car
{
   Door leftDoor; // door object, for left door
   Door rightDoor;, // door object, for right door
public:
   openLeftDoor() {    // message to open the left door of the car
      leftDoor.open(); // internally it is passing the message to the door object to open it.
   }
   openRightDoor() { // message to open the right door of the car
      rightDoor.open();
   }
}
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 22

Expert Comment

by:grg99
ID: 16933210
C++ objects do NOT communicate with each other.  Let's settle that.  There is no built-in feature in C++ to do this.

0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16934496
>> C++ objects do NOT communicate with each other.  Let's settle that.  There is no built-in feature in C++ to do
>> this.
Is that true ?
Then how one object uses another object ?
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16934504
Also I want to know in which language object communicate with each other ?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question