I don't really understand the difference between using include and adding a class.
For example: using include :
+++++++++++++++++++++++
// First case
#include "myA.h"
class myB {
.
.
}
+++++++++++++++++++++++
//Second case
class myB {
class myA;
.
.
}
+++++++++++++++++++++++
Thanks and I would look forward to your information.
Using #include copies the contents of that file into the file you are currently in. Since the header files usually have the class declarations in them, that would give you something like:
1 2 3 4 5 6 7
class myA {
// ...
}
class myB {
// ...
}
Your second case seems like it is trying to declare a "prototype" of myA inside class myB...? That isn't really comparable and doesn't make sense to me.
if you are talking about this.. it may be called association in uml terms..
it can of two type aggregation and composition.
giving an example of association..
department has professors(aggregation, as destroying dept doesnt destroy professors)
university has a department (composition, as destroying university destroys department also).
but it will make sense if you declare myA or make an object of myA inside myB.