C
Chris Forone
hello group,
is it possible to use derived class objects in base class static function?
example:
#include <iostream>
class b;
class a
{
public:
a() {}
virtual ~a() {}
static void Init() {b thing; thing.Do();} // compile
// error
};
class b : public a
{
public:
b() {}
virtual ~b() {}
void Do() {std::cout << "hello?" << std::endl;}
};
int main()
{
a::Init();
}
thanx & hand, chris
is it possible to use derived class objects in base class static function?
example:
#include <iostream>
class b;
class a
{
public:
a() {}
virtual ~a() {}
static void Init() {b thing; thing.Do();} // compile
// error
};
class b : public a
{
public:
b() {}
virtual ~b() {}
void Do() {std::cout << "hello?" << std::endl;}
};
int main()
{
a::Init();
}
thanx & hand, chris