Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!uwm.edu!bionet!apple!netcom!teda!ditka!mcdchg!tellab5!balr!clrcom!rmartin From: rmartin@clear.com (Bob Martin) Newsgroups: comp.lang.c++ Subject: Re: enums and function/method return values Message-ID: <1991Feb4.153156.15087@clear.com> Date: 4 Feb 91 15:31:56 GMT References: <48742@apple.Apple.COM> Organization: Clear Communications, Inc. Lines: 32 In article <48742@apple.Apple.COM> ksand@apple.com (Kent Sandvik) writes: >I'm not sure that this is syntactically OK, but I would like to >achieve better function return value scoping using enums. Ex: > >class TFoo { >public: > TFoo(){}; > virtual eFoobar GetStatus(void){ return fStatus;}; > enum eFoobar {OK, NOK, MAYBE}; >private: > eFoobar fStatus; >// .... >}; > >I'm using Mac MPW 1.0 C++ (AT&T 2.0 derivate). I also tried with >typecasting, but the compiler did not like this either. Anyway >it complains about eFoobar not being a type name. >Kent Sandvik Kent: I got the same error using SUN's 2.0 compiler. But when I moved the enum statement up above the TFOO(){} constructor the error went away. -- +-Robert C. Martin-----+:RRR:::CCC:M:::::M:| Nobody is responsible for | | rmartin@clear.com |:R::R:C::::M:M:M:M:| my words but me. I want | | uunet!clrcom!rmartin |:RRR::C::::M::M::M:| all the credit, and all | +----------------------+:R::R::CCC:M:::::M:| the blame. So there. |