9 Years
Discussion Span
Last Post by ArkM

For a complete answer, you need to provide a better description of what you're trying to do. What do you mean by "share"? If you just want a function to be visible, make it public. If you want multiple classes to see the same variable, the proper course of action depends on the circumstances.


Topic... just wondering if it would be friend or pointers in the main or something else...

It depends. Can you describe some program cases where you need to share (polysemantic term) variables?


well its in the api allegro, I want two public classes to share variables and use eachothers functions


Classes or (all) objects of these two classes?
Feel the difference...

The simplest way: there lots of global variables in Allegro environment. Add yet another or two ;)...

Seriously: explain use case(s) where you need so tight interrelations. May be it's ONE class splitted to these weird wrecks?..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.