Dave Wrote:I would say a collection of classes would be faster than an array of UDT's, and the classes allow infinitly more possibilities to what you can do. It's a more "professional" way to do things, and also more modern.. It's also abstract, and hard to do.
I am almost positive classes would be slower. A UDT is just a collection of variables while a class is a collection of variables in an object that can raise events for the objects called.
They both have their ups and downs. Classes can help create a lot cleaner of coding since you can do invalid value checks directly from the class. For example, if you have the user's HP, you can check every time the HP changes that if it is over the Maximum HP.
I myself don't use classes that much. I should get in the habit of using them more. But I still see them used way the hell more than they used. For example, some people make classes for a FPS counter - what the hell is the point of that? Not only is that something that has absolutely no need for events, it is only done in one place in the code and referenced in the rest.
You also can't use classes with direct bulk alterations of memory. That means no CopyMemory, ZeroMemory, Put #f, , MyClass, etc. Of course, you could have a UDT in the class, but then you can still only go one class at a time.
So classes aren't there for performance, they're just easier. If it works without classes, don't touch it. No point in downgrading its performance farther unless you are really aiming for cleaner code.