Newbie question: classes "A" and "B". A "B" object declared inside class "A"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have declared two classes: class CPrueba and class CPrueba2.

The class CPrueba contains a CPrueba2 object.

When i try to compile a main.cpp file with a CPrueba object inside using 
"g++ main.cpp CPrueba.cpp CPrueba2 -o main"  i get this error:

‘CPrueba2’ no nombra a un tipo (In spanish means 'CPrueba2 doesn't name a
type' or maybe "CPrueba2 is not a type").

Can you help me?

These are my little classes:

//////// CPrueba.h ///////////////

class CPrueba

{
private:
CPrueba2 pru2;
};


//////// CPrueba.cpp ///////////////

#include "CPrueba.h"

 //////// CPrueba2.h ///////////////

class CPrueba2

{
private:
int n;
};



//////// CPrueba2.cpp ///////////////

#include "CPrueba2.h"


//////// main.cpp ///////////////

#include "iostream.h"
#include "CPrueba2.h"
#include "CPrueba.h"

int main()
{

CPrueba pru;

}

-- 
View this message in context: http://www.nabble.com/Newbie-question%3A-classes-%22A%22-and-%22B%22.-A-%22B%22-object-declared-inside-class-%22A%22-tf4244416.html#a12078296
Sent from the gcc - Help mailing list archive at Nabble.com.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux