classes or structs in VB

Started by
2 comments, last by capn_midnight 22 years, 2 months ago
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

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Advertisement
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)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
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.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

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

This topic is closed to new replies.

Advertisement