Topic: constuctor typedef
Author: "restor" <akrzemi1@interia.pl>
Date: Fri, 23 Feb 2007 15:50:41 CST Raw View
C++ standard says (12.1.3):
A typedef-name that names a class is a class-name; however, a typedef-
name that names a class shall not be used as the identifier in the
declarator for a constructor declaration.
Does anyone know a rationale for that?
I really would like a typedef of a class name the same way I can use
"inherited" as a typedef of the base class:
class LongNameOfDerivedClass : public LongNameOfBaseClass
{
typedef LongNameOfBaseClass inherited;
typedef LongNameOfDerivedClass self;
public:
self() : inherited() { /*...*/ }
self( self const& copy ) : inherited(copy) { /*...*/ }
self & operator=( self const& copy ) { /*...*/ }
~self(){/*...*/}
};
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]