Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 typedef in Java?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Martin




PostPosted: Tue Oct 04, 2005 4:01 am   Post subject: typedef in Java?

Is there anything equivalent to typedef in Java?
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Tue Oct 04, 2005 9:43 am   Post subject: (No subject)

No.
wtd




PostPosted: 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




PostPosted: 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




PostPosted: 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]




PostPosted: 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




PostPosted: 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. Smile
[Gandalf]




PostPosted: 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 Smile.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: 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




PostPosted: 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]




PostPosted: Tue Oct 04, 2005 11:18 pm   Post subject: (No subject)

Sure, but then that would be an improper class, right? Smile
wtd




PostPosted: Tue Oct 04, 2005 11:33 pm   Post subject: (No subject)

From an OOP standpoint, yes. Very much so.
Martin




PostPosted: 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




PostPosted: Wed Oct 05, 2005 1:38 am   Post subject: (No subject)

Member variables and member functions public by default.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: