Archived

This topic is now archived and is closed to further replies.

classes or structs in VB

This topic is 5827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I know classes and structs for C/C++ really well. I''m pretty sure VB has such a thing. What is it called and how do you use them? I can''t seem to find anything on it. I''m working on an asteroids clone. I just got it to where it recognizes more than one keydown at a time, and now I want to set up some classes for vectors instead of using regualar variables. AOL, so easy to use, no wonder it''s nothing but a bunch of retards Spyder''s Web Games

Share on other sites
in VB a struct is a "user defined type" and is declared as follows:
Public Type SomeStruct   ID As Long   Name As String   X as Single   Y As SingleEnd Type

a class is it''s own file, it is called a "class module", and i can''t really explain them properly without going on and on and on...
a VB class is actually a COM object (not a class as it is in c++)... they can''t be derived or anything good like that (although it allows interfaces, which are a poor substitute)... but once you get use to it they are OK...
if possible, use TYPES (structs) not classes... unlike the c++ ones they are very different, and using types is much much faster than classes...
HTH!

--- krez (krezisback@aol.com)

Share on other sites
Yo, thanks for the quick responce. That is exactly what I needed. I can now continue blissfully

Embrace the id. You will never go hunger.

Share on other sites
I believe VB.net supports ''proper'' classes. And inheritance etc ... A big leap forward me thinks