Changing return types. - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: General (http://qbasicnews.com/newforum/forum-6.html) +--- Forum: General/Misc (http://qbasicnews.com/newforum/forum-18.html) +--- Thread: Changing return types. (/thread-3212.html) Pages:
1
2
|
Changing return types. - PlayGGY - 02-16-2004 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. Changing return types. - Sterling Christensen - 02-16-2004 QB doesn't let you return user defined types, but you can use a parameter instead. Changing return types. - PlayGGY - 02-16-2004 That is what I was afraid of... Anyone know why they decided to force you to pass by reference? Changing return types. - na_th_an - 02-16-2004 They didn't. You can use BYVAL to pass by value Changing return types. - PlayGGY - 02-16-2004 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. Changing return types. - adosorken - 02-16-2004 Every other modern language allows you to do this. However, keep in mind that QB is exceptionally old. Changing return types. - PlayGGY - 02-16-2004 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. Changing return types. - adosorken - 02-16-2004 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. Changing return types. - PlayGGY - 02-16-2004 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,. Changing return types. - adosorken - 02-16-2004 No idea. It'd be quite useful though... Oh well...VB does it quite well |