Solved

object communication

Posted on 2006-06-26
6
245 Views
Last Modified: 2010-04-01

sir

 i m working on ansi c .


 here , class A
          class B

wat r the differnt communication possible bet objects of these classes

ie , A a ,B b ; how can u communicate bet  ,a & b
  ??
0
Comment
Question by:karana
  • 3
6 Comments
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16982939
>> i m working on ansi c .
I think C++ :)
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16982951
>> wat r the differnt communication possible bet objects of these classes
What exactly A and B do ?

Until you are not sure about the class of object you cannot put members in it.
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16982959
0
 
LVL 15

Accepted Solution

by:
bpmurray earned 50 total points
ID: 16983028
First, when posting a question, please write in English - NEVER use the abbreviations you might use in SMS messages. So the words are "what", "are", "you", etc.

The idea that objects communicate with one another simply refers to the way in which they refer to each other's  methods. There are very complex solutions that use message queues where an object adds a message to another object's message queue, but it's still just calling a method on the other object. Now, objects can have two different kinds of relationships - "is a" and "has a". If A "is a" B, it simply means that A is a descendant of B (inheritance), while if A "has a" B, it means that A contains an instance of B. In both of these situations, class A can execute a method on the class B, and that's how they communicate.
0
 
LVL 17

Expert Comment

by:rstaveley
ID: 16990616
Objects call other objects' class functions, which rajeev_devin argues in http:Q_21890796.html is the extent of inter-object communication natively supported by the C++ language. I agree with him. That's all the language provides you. You can design your own message queues or use message queues provided by your operating system or use interprocess communication in C++, but that's beyond the scope of what's provided by the C++ language.

> wat r the differnt communication possible bet objects of these classes

Name your operating system if you want to use an API or define the height of your sky if you want to design something yourself. You might have an object responsible for banging a drum, which another object listens to.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

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