Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > How to pass enu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 9508 of 9591
Post > Topic >>

How to pass enum as default argument

by jeremit0 <jeremit0@[EMAIL PROTECTED] > Apr 16, 2008 at 03:44 PM

I am having an issue with passing an enum as a default argument to a
class method.  I have a class similar to

enum Method { a, b };

class A{
    A();
    void MyMethod(int i, Method m = a){
    ...
   }
}

The compiler error I get says

error: default argument for 'Method m' has type '<unknown type>'

How can I use a default argument for an enum?

Thanks,
Jeremy

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]




 3 Posts in Topic:
How to pass enum as default argument
jeremit0 <jeremit0@[EM  2008-04-16 15:44:46 
Re: How to pass enum as default argument
Chris Uzdavinis <cuzda  2008-04-17 03:49:38 
Re: How to pass enum as default argument
Ulrich Eckhardt <eckha  2008-04-17 03:59:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 9:34:31 CDT 2008.