Solved

object communication

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

816 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

11 Experts available now in Live!

Get 1:1 Help Now