Hey, I am working on a program in Direct X (C++, not C#), and want to practice working on physics using particles in QBasic. I haven't programmed in QBasic in a while, and I can't seem to make functions return my user-defined types. This must be possible (I can't imagine MS would want to make you pass by reference instead).
Please tell me this is possible, I don't want to have to go ahead and learn C# for quicky practice things like this.
QB doesn't let you return user defined types, but you can use a parameter instead.
That is what I was afraid of...
Anyone know why they decided to force you to pass by reference?
They didn't. You can use BYVAL to pass by value
Quote:They didn't. You can use BYVAL to pass by value
Sorry, I meant "Why did they force you to pass by value instead of returning a user-defined type?"
Every other language I know of allows you to return any type, not just the built in.
Every other modern language allows you to do this. However, keep in mind that QB is exceptionally old.
Quote:Every other modern language allows you to do this. However, keep in mind that QB is exceptionally old.
Well, C and Scheme are older than QB, as well as I beleive C++ and Lisp.
BASIC is older than C. And virtually all modern BASICs allow your own return types for your own functions. QB 4.5 simply doesn't. I am not sure, but I think 7.1 actually does. Anyone care to confirm this? I don't have a copy handy at the moment.
And don't forget that QB is a compiler that compiles a form of BASIC. C has many compilers but there is no compiler called C.
BASIC is older than C, you are right, but it came out about 20 years befroe QBasic. I was just wondering if anyone knew why MS didn't see the need for functions to return user-defined types,.
No idea.
It'd be quite useful though...
Oh well...VB does it quite well