Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Can i refer to an ENUM from another class?
I have following code in class A
enum SOMETHING {some1, some2, some3}

Now, i create an object of that class by
A a = new A ();

I wish then to use the values of SOMETHING as follows
... = a.some1;
or
... = a.SOMETHING.some1;
or something similar.

However, the compiler diagrees with me by
"cannot find symbol variable some1"

What do i do uncleaverly?

--

Vänligen
Konrad
---------------------------------------------------

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy

---------------------------------------------------


Report this thread to moderator Post Follow-up to this message
Old Post
Konrad Viltersten
06-05-05 01:57 PM


Re: Can i refer to an ENUM from another class?
On 6/5/2005 at 4:51:50 AM, Konrad Viltersten wrote:

> I have following code in class A
> enum SOMETHING {some1, some2, some3}
>
> Now, i create an object of that class by
> A a = new A ();
>
> I wish then to use the values of SOMETHING as follows
> ... = a.some1;
> or
> ... = a.SOMETHING.some1;
> or something similar.
>
> However, the compiler diagrees with me by
> "cannot find symbol variable some1"

A.SOMETHING.some1

While you can use an class reference variable (i.e. "a") to qualify
the name of a static field, you cannot use one to qualify then name
of a nested type.

--
Regards,

John McGrath

Report this thread to moderator Post Follow-up to this message
Old Post
John McGrath
06-05-05 08:58 PM


Re: Can i refer to an ENUM from another class?
>> enum SOMETHING {some1, some2, some3} 
>
> A.SOMETHING.some1
>
> While you can use an class reference variable (i.e. "a") to qualify
> the name of a static field, you cannot use one to qualify then name
> of a nested type.


Thanks.

--

Vänligen
Konrad
---------------------------------------------------

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy

---------------------------------------------------


Report this thread to moderator Post Follow-up to this message
Old Post
Konrad Viltersten
06-06-05 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:45 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.