473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

enum operator overloading in namespaces

Hey all. I posted this originally:

http://groups.google.com/group/comp....e4b76201ce17f1
I got the enums to work how I like but I am having a problem with the
overloading of the assignment operator:

namespace UserAffilliationType
{
enum UserAffilliationType //
user.getInfo.affiliations.affiliations_elt.type
{
collegeNetwork = 1,
highSchoolNetwork = 2,
workNetwork = 3,
geographyNetwork = 4
};
UserAffilliationType&
UserAffilliationType::operator=(UserAffilliationTy pe& lhs, const
QString &rhs);
}

When mingw32 trys to compile the overloading statment I get

In file included from kernel/FBNKernel_includes.h:22,
from fbNotify.h:27,
from fbNotify.cpp:18:
kernel/FBNKernelEnums.h:35: error:
`facebook::UserAffilliationType::UserAffilliationT ype&
facebook::UserAffilliationType
::operator=(facebook::UserAffilliationType::UserAf filliationType&,
const QString&)' must be a nonstatic member function
mingw32-make[1]: *** [release\fbNotify.o] Error 1

Any ideas on how I can get something like this to work?

MyUserAffilliationType = MyQString;

Oct 10 '06 #1
1 4224
I'm trying
class UserAffilliationType
{
enum { vals };
};

It works for the operator, but how do i refrence to the enum?
th**********@gmail.com wrote:
Hey all. I posted this originally:

http://groups.google.com/group/comp....e4b76201ce17f1
I got the enums to work how I like but I am having a problem with the
overloading of the assignment operator:

namespace UserAffilliationType
{
enum UserAffilliationType //
user.getInfo.affiliations.affiliations_elt.type
{
collegeNetwork = 1,
highSchoolNetwork = 2,
workNetwork = 3,
geographyNetwork = 4
};
UserAffilliationType&
UserAffilliationType::operator=(UserAffilliationTy pe& lhs, const
QString &rhs);
}

When mingw32 trys to compile the overloading statment I get

In file included from kernel/FBNKernel_includes.h:22,
from fbNotify.h:27,
from fbNotify.cpp:18:
kernel/FBNKernelEnums.h:35: error:
`facebook::UserAffilliationType::UserAffilliationT ype&
facebook::UserAffilliationType
::operator=(facebook::UserAffilliationType::UserAf filliationType&,
const QString&)' must be a nonstatic member function
mingw32-make[1]: *** [release\fbNotify.o] Error 1

Any ideas on how I can get something like this to work?

MyUserAffilliationType = MyQString;
Oct 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nils Petter Vaskinn | last post by:
I'm using an enum that's declared within a function (since I only need it within that function.) I can't find anything about this in "The C++ Programming Language" by Stroustroup and I don't...
0
by: Jonathan Mcdougall | last post by:
For use in many of my projects, I implemented an enum with scope using a class containing an enum with operator overloading. Wrapped in a macro, it gives class A { public: scoped_enum(Test)...
6
by: PengYu.UT | last post by:
Hi, I have some problem when I use enum with stream. The code segment is listed below. I know if I change the first line to "int op;", there will not be any error. However, what I really want is...
4
by: John Salerno | last post by:
I created this enumeration: enum Status { Off = 0, Red = 1, Yellow = 2, Blue = 4, Overload = 8
6
by: TuxC0d3 | last post by:
Hi! I'm diving into the some more ++ specific aspects of c++ (and finally accepting that c++ is more than "a plus added to c" :), so that means using namespaces, templates, std::strings, lists,...
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
11
by: jakester | last post by:
I am using Visual C++ 2007 to build the code below. I keep getting linkage error. Could someone please tell me what I am doing wrong? The code works until I start using namespace for my objects. ...
10
by: yu_kuo | last post by:
I got series warning when using write enum type to a ostream using operator<<, like in call to `std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) '...
9
by: Roger | last post by:
enum status { CONTINUE, WON, LOST } What do we really need to use enum for? I'm not sure what the use of it is really for... Maybe I just don't quite understand. My textbook says that these...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.