I have a C++ class which is meant to be inherited. All its children will inherit a method:
class Record {
public:
RETTYPE* all();
};
class Child : public Record {
int age;
char *name;
};
int main() {
Child boo;
Child boos* = boo->all(); // Pointer to array of Children
return 0;
};
How can I make a method return (a pointer to) itself? I can't just say Record all();
as Child
is not Record
. The method will never be called on Record
. Always on some class inherited from Record
.
Can anyone help me? Thanks.