I'm a beginner in C++ programming and I've a (stupid, I think) doubt about how to pass an object's class into another class. Suppose we have these two classes:
class A {...}
class B {...}
and I want to use an object from A into B. For example:
class B {
A ab;
[methods prototypes that include the object ab]
method_B (A ab); //for example
...
}
The question is, can I do this? Does it make sense, thinking about object-oriented programming?
Or, I could define an A's object in main() and after that I would call a method from B that would include A's object as argument?
My question is all about how to use object's from another class into another (functionally independent!) without "violating" the object oriented programming rules.
Thank you for any help,