This question is going to sound absolutely rediculous especially since I've already tried to look up on Google without much success... worst part is, I know it to I just haven't worked in C++ for awhile and I know I'm going to bang my head on my desk when I get an answer... so here goes:
I'm creating a base class from which there will be derived classes. Whoop dee doo. However, I can't seem to figure out how the constructors work with inherited classes:
Here's the code (minus comments for the sake of simplicity):
Code:
class Resource
{
public:
Resource(char *filePath);
~Resource();
char *getName();
virtual bool load() = 0;
protected:
char *mResourceName;
};
class Image : public Resource
{
public:
bool load();
private:
};
Now, here's where I have the problem:
Code:
Image *img = new Image("filename.ext");
Generates the following error:
Code:
error C2664: 'Image::Image' : cannot convert parameter 1 from 'const char [9]' to 'const Image &'
Clearly I forgot something... but I just can't remember what.
I really do feel foolish about this but I hope that at the very least it's good for a couple of laughs.
Thanks for your time.
EDIT:
Just resolved my problem. Thanks for any would-be help!