On Apr 6, 11:42 am, SasQ <s...@go2.plwrote:
Dnia Fri, 06 Apr 2007 11:21:37 -0700, newbie napisał(a):
class AbstractBook {
public:
virtual static AbstractBook* Allocate () =0;
static method cannot be virtual, because it's not
bounded with any particular object, but with the
class of objects as a whole.
Then, can I do something like
class AbstractBook {
public:
static AbstractBook* Allocate () { return NULL;};
virtual PrintTitle() = 0;
}
class ScifiBook : public AbstractBook {
public:
static AbstractBook* Allocate () { return new ScifiBook; }
virtual PrintTitle() { cout << "scifi"; }
private:
int num_stories;
}
class NovelBook : public AbstractBook{
static AbstractBook* Allocate () { return new NovelBook; }
virtual PrintTitle() { cout << "Novel"; }
private:
int num_pages;
}
I mainly want to have different version of Allocate (), which will be
the interface to another function.
Thanks,
>
--
SasQ