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

base class has incomplete type

Status
Not open for further replies.

csripriya1

Programmer
May 13, 2003
35
US
What does this base class has incomplete type mean.
I have a base class by name chromosome and the derived class by name offspring. In the file where I start the definition of derived class , i did include the header file that has the definition of base class.

Can anyone help me

Thanks in advance
 
are you using templates there?

Ion Filipski
1c.bmp
 
No ,I did not use any template.

I missed a key point in my earlier post. In the derived class I have a member which is of parent class.
I have Chromosome as basic class and I have Offpsring as derived class. In the Derived class offspring I have a member of type chromosome.
I guess this is the one that causes the compilation error.
Can any one please suggest a way to get around with it.

Thanks for your time
 
could you please post there the lines of classes and members declarations?(only lines with problems)

Ion Filipski
1c.bmp
 
> In the derived class I have a member which is of parent class.

Why? Seems like there would be a better way of doing whatever you're trying to do.

Inheritance should be used to model an "is a" relationship. I'm a Biology minor, and I don't see "Offspring" being a "Chromosome." You might want to rethink your relationships there.

And yes, posting some code would be helpful, here.
 
Thanks for the suggestions.

Here I define the derived class
#ifndef offspringlib
#define offspringlib

#include "Chromosome.h"


class offspring:public chromosome
{
friend class chromosome;
protected:
chromosome parent_chrom;
public:

};
#endif

I am trying to get the offspring as a derived class, because this class will have additional members to remember the parent chromosome and its fitness etc in addition to the members declared in the chromosome class.

Thanks for the time
 
How about showing the base class as well? There is nothing wrong compiler-wise (though I wonder why you have the friend thingie) with the code you've posted.


/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
Hi all,
Thanks for the suggestions. I worked this problem out in some other way.

Thanks
 
Hi,

I have the same problem with a framework I am developing atm. Could you please tell me how you overcame this error.

Thanks for your help.

Leo
 
Your offspring is chromosome (by inheritance). What for this (obviously wrong and redundance) parent_chrom member?
Try to understand inheritance concept better...
 
Well in the real world, an offspring has many chromosomes, but it is not a chromosome itself. Deriving in this case makes no sense.
 
Sorry, but read the thread and check the dates; I pointed out that this use of inheritance made no sense almost a year ago.

Please don't resurrect dead threads unless you have a good reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top