|
-
November 24th, 2009, 11:43 PM
#1
Inheritance Problem
I have not used C++ in about a year and I was trying to get my project to use Inheritance. I have already created my header file that looks something like:
class Instructions // start class Instructions
{
public:
Instructions();
Instructions(const char*);
Instructions(Instructions*);
~Instructions();
const Instructions & operator = (const Instructions&);
friend ostream & operator << (ostream&, const Instructions&);
Instructions(vector<string> sendingVect);
virtual int foobar();
};
class LDI: public Instructions
{
protected:
double healthValue;
public:
LDI(LDI*);
LDI(int value);
};
class LD: public Instructions
{
protected:
double capacity;
public:
LD();
LD(LD*);
};
I also have Instructions.cpp file that has the correct Constructors for each class:
Instructions::Instructions()
{
return;
}
LDI::LDI(int valueTemp)
: Instructions()
{
value = valueTemp;
}
LD::LD()
: Instructions()
{
//capacity = sentCapacity;
}
So when I create an instance in main.cpp of Instruction nothing happens it works fine, but when I try to do:
LDI *test = new LDI();
inside main it gives me an error saying that LDI is not a type. I have also tried doing Instructions *test = new LDI(); I still get the same error. Does anyone know a good solution to this error?? Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|