Solved

object communication

Posted on 2006-06-26
6
222 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
Comment Utility
>> i m working on ansi c .
I think C++ :)
0
 
LVL 12

Expert Comment

by:rajeev_devin
Comment Utility
>> 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
Comment Utility
0
 
LVL 15

Accepted Solution

by:
bpmurray earned 50 total points
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
  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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

763 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

9 Experts available now in Live!

Get 1:1 Help Now