LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2007, 12:29 AM   #1
rohithzhere
LQ Newbie
 
Registered: Dec 2007
Posts: 1

Rep: Reputation: 0
Need Help On Enums


Hi all,

I m a newbie to programming. I was working on Enums in C++. I was not able to copy enum of one class to enum of another class. please help me on this issue.
 
Old 12-19-2007, 02:19 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
We cannot see such a problem without seeing it. Please post code you have so far.
 
Old 12-19-2007, 12:48 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

In C++, every different enum you define is literally a different "type". So it makes sense that you wouldn't be able to copy directly from one "type" (one enum in one class) to another (a different enum in a different class) without casting. This is somewhat different from "C" enums (which lets you more or less freely interchange different enums).

Here is some more information on the subject:

http://en.wikipedia.org/wiki/Enumerated_type

'Hope that helps .. PSM

PS:
If my hunch about your real question is incorrect, or if you have further questions, please follow HKo's advice and post sample code illustrating the problem. It definitely helps ;-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
size of arrays/enums h/w Programming 6 12-21-2003 04:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration