Author |
Message |
Martin
|
Posted: Tue Oct 04, 2005 4:01 am Post subject: typedef in Java? |
|
|
Is there anything equivalent to typedef in Java? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rizzix
|
Posted: Tue Oct 04, 2005 9:43 am Post subject: (No subject) |
|
|
No. |
|
|
|
|
|
wtd
|
Posted: Tue Oct 04, 2005 12:03 pm Post subject: (No subject) |
|
|
What are you trying to accomplish? Perhaps we can help you find something that's functionally equivalent. |
|
|
|
|
|
Martin
|
Posted: Tue Oct 04, 2005 9:10 pm Post subject: (No subject) |
|
|
Just trying to shorten some variable declarations is all.
Actually, I was trying to figure out if there was something similar to #define (so I could define a for-each loop in java 1.4.2) and then I realized that I couldn't use typedef either. |
|
|
|
|
|
wtd
|
Posted: Tue Oct 04, 2005 9:16 pm Post subject: (No subject) |
|
|
The lack of text-substitution macros is a good thing.
The lack of macros is not so good. |
|
|
|
|
|
[Gandalf]
|
Posted: Tue Oct 04, 2005 10:18 pm Post subject: (No subject) |
|
|
I was going to ask something similar, so there are no structs, or anything like that in Java? I was trying to think of ways other than classes, and read some in my C book... |
|
|
|
|
|
wtd
|
Posted: Tue Oct 04, 2005 10:41 pm Post subject: (No subject) |
|
|
No, there are not structs in Java. But then, structs in C++ are not really structs either. |
|
|
|
|
|
[Gandalf]
|
Posted: Tue Oct 04, 2005 10:44 pm Post subject: (No subject) |
|
|
So most (all) organization is done with classes?
Indeed... Just for the record, I was not neglecting to put the ++, it was a C book that I was reading . |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Tue Oct 04, 2005 10:49 pm Post subject: (No subject) |
|
|
[Gandalf] wrote: So most (all) organization is done with classes?
Yes, all organization is done within the context of a class. |
|
|
|
|
|
Martin
|
Posted: Tue Oct 04, 2005 10:56 pm Post subject: (No subject) |
|
|
Just make a class and make all of the member variables public. There, you have a C++ struct. |
|
|
|
|
|
[Gandalf]
|
Posted: Tue Oct 04, 2005 11:18 pm Post subject: (No subject) |
|
|
Sure, but then that would be an improper class, right? |
|
|
|
|
|
wtd
|
Posted: Tue Oct 04, 2005 11:33 pm Post subject: (No subject) |
|
|
From an OOP standpoint, yes. Very much so. |
|
|
|
|
|
Martin
|
Posted: Wed Oct 05, 2005 12:22 am Post subject: (No subject) |
|
|
But really, that's all that C++ structs are - classes with member variables public by default. |
|
|
|
|
|
wtd
|
Posted: Wed Oct 05, 2005 1:38 am Post subject: (No subject) |
|
|
Member variables and member functions public by default. |
|
|
|
|
|
|