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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

base class undefined

Status
Not open for further replies.

Casiopea

Programmer
Jan 15, 2003
47
ES
I have defenided two classes like:

class Conversion{
Conversion(BOOL corregido);
};

class ConversionHTML:public Conversion{
...
};

then I use
ConversionHTML::ConversionHTML(BOOL corregido):Conversion(corregido){}

Inside the constructor of Conversion there are operations.

If I just compile the file ConversionHTML.cpp it finds no errors; however when I compile Conversion.cpp it sends one error:
"Conversion: base class undefined" and it marks the file ConversionHTML at the constructor. It has Conversion.hpp included on ConversionHTML, and if Conversion is the parent class, I do not know the reason why it referes to the child class.
 
Hi!
It's quite interesting what did you get. But maybe try this:

class Conversion{
public:
Conversion(BOOL corregido);
};

Did you include all need files in right order?

Best

Bartek
 
Bartec is right: by default you have private Conversion constructor. You may not access it outside the class (in derived class too).
Use this method only if you don't want to construct this class objects in this manner. For example, you don't want to copy class objects:
Code:
class DontCopyMe
{
DontCopyMe(const DontCopyMe&); // Unaccessible copy ctor
DontCopyMe& operator =(const DontCopyMe&); // can't assign
public:
...
};
 
Yesterday afternoon I finally fixed the problem. I had the include files Conversion.hpp inside ConversionHTML.hpp with #ifdef and #endif clauses; instead of that, I have included Conversion.hpp in ConversionHTML.cpp; don't ask me why but it works.
Thanks anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top