Solved

object communication

Posted on 2006-06-26
6
231 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now