VBGamer |
|
RE: a thing about classes Joviex (0 replies, 0 views) (2000-Jul-22) Yes and no.
Classes are fast when compiled, yes, but only if you use "early binding". That is, you know what the class is before you use it, rather than "late binding" where you let the system enumerate the classes to discover what kind of class it is.
Aside from that, I would say go with UDT's only in C (of course) or C++ (which are really Classes in disguise). As fer VB, definately go with classes and try to use early binding as much as possible.
Like, if I was making a scene graph, I wouldn't try and stuff all sorts of lights, cameras, meshes, particle systems, etc... into one collection and then at runtime use a
for each light in collection
do light
next
for each mesh in collection
do mesh
next
this is an extremely bad way to use classes. Best approach for something like this is to call back directly to a master class for each collection
scenegraph.dolights
( inside the scenegraph class)
public sub dolights
for i = 1 to lightcollection.count
light(i).dolight
next i
end sub
believe it or not, this is faster. You can find a few samples on late and early binding tests on codehound or even planetsource.com |