Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

c++ object interaction

Status
Not open for further replies.

Dreadson

Instructor
Jun 11, 2003
63
US
How do class objects access each other's functions and members in c++? I have all the classes I need, but I'm still wondering what the "standard" way of having them communicate and interact is.
 
A function in object A creates an instance (or receives a reference) of object B. It then calls a function in object B and passes whatever data is required...
 
So there must be a main controller that is aware of all the unique instances of every class and manages the interactions among them?
 
Well execution of the program always starts at a function called main().
main() then creates whatever objects it needs and then those objects might create and call other objects... but main() only knows about the objects that it explicitely created.
Once all control paths return back to main() and there are no more instructions left to run in main() (or if exit() or return are called) the program ends.
 
You can have objects that are subclasses of other objects, so they automatically have all the methods of the original class unless explicitly replaced plus any methods you choose to give them.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top