Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing return types.
#1
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.
Reply
#2
QB doesn't let you return user defined types, but you can use a parameter instead.
Reply
#3
That is what I was afraid of... Sad

Anyone know why they decided to force you to pass by reference?
Reply
#4
They didn't. You can use BYVAL to pass by value Smile
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
Quote:They didn't. You can use BYVAL to pass by value Smile

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.
Reply
#6
Every other modern language allows you to do this. However, keep in mind that QB is exceptionally old.
I'd knock on wood, but my desk is particle board.
Reply
#7
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.
Reply
#8
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. Sad 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.
I'd knock on wood, but my desk is particle board.
Reply
#9
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,.
Reply
#10
No idea. Smile It'd be quite useful though... Sad Oh well...VB does it quite well Big Grin
I'd knock on wood, but my desk is particle board.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)