Talk About Network

Google


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 > Re: How to pass...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 9508 of 9831
Post > Topic >>

Re: How to pass enum as default argument

by Chris Uzdavinis <cuzdav@[EMAIL PROTECTED] > Apr 17, 2008 at 03:49 AM

On Apr 16, 5:44 pm, jeremit0 <jerem...@[EMAIL PROTECTED]
> wrote:

> 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?

That is valid code.  Perhaps your compiler has a bug?

-- 
Chris

      [ 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 Sat Jul 26 2:43:08 CDT 2008.