Re: OO Design Question
Posted: Thu Apr 09, 2009 12:30 pm
Did you spell Renderer right in your class definition? Also, caps matters. Essentially it's saying that it has no idea what "Renderer" is. Another possible problem is that maybe you missed a semicolon in renderer.h or any include file of yours that is included in renderer.h. Since it comes and goes and compile order is arbitrary I would think that it would be something like this second one.
Also, re "Is there something special I need to do when making a class a member of another class?"
No. But, if you're just using a pointer, you can save recompile time by declaring a class prototype, say,This means that if you change something in renderer.h you won't have to recompile all the files that #include myclass.h. In other words, it limits the ripple effect of changing a header.
But if you declare it as a non-pointer, you have to
Also, re "Is there something special I need to do when making a class a member of another class?"
No. But, if you're just using a pointer, you can save recompile time by declaring a class prototype, say,
Code: Select all
class Renderer;
class MyClass {
Renderer* renderer;
};
But if you declare it as a non-pointer, you have to
Code: Select all
#include "renderer.h"
class MyClass {
Renderer renderer;
};