G
Gernot Frisch
Hi,
assume this situation:
class primitive
{
virtual void IsPointInside() =NULL;
};
class sphere : public primitive
{ ... };
class tetrahedron : public primitive
{ ... };
std::vector<sphere > v_sphere;
std::vector<tetrahedron> v_tetrahedron;
// Can I do this:
std::vector<primitive*> v_pPrimitives;
for(i=v_sphere.begin; i!=v_sphere.end(); ++i)
v_pPrimitives.push_back(&*i);
....
// and call the v_pPrimitives.IsPointInside(); ??
<head scratch>
I can't store different types in a single array, but I can store their
pointers, no!?
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
assume this situation:
class primitive
{
virtual void IsPointInside() =NULL;
};
class sphere : public primitive
{ ... };
class tetrahedron : public primitive
{ ... };
std::vector<sphere > v_sphere;
std::vector<tetrahedron> v_tetrahedron;
// Can I do this:
std::vector<primitive*> v_pPrimitives;
for(i=v_sphere.begin; i!=v_sphere.end(); ++i)
v_pPrimitives.push_back(&*i);
....
// and call the v_pPrimitives.IsPointInside(); ??
<head scratch>
I can't store different types in a single array, but I can store their
pointers, no!?
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com