From: Daniel Krügler on 2 Feb 2010 06:13 On 2 Feb., 21:23, pion <vahan...(a)poczta.onet.pl> wrote: > Can anyone answer if this is a valid C++ syntax - look at constructors > ended with comma - not semicolon: > > class Test { > public: > Test(), > Test(int a), > ~Test(); > int getA() const; > private: > int a; > > }; > > Full test code here:http://ideone.com/NT4DL588 This question occurs once in a while, which is understandable, because the code looks rather odd ;-) [And I never have seen such code in a productive environment] Nevertheless it is valid C++, because we meet here the grammar element /member-declarator-list/, which is defined to be member-declarator-list: member-declarator member-declarator-list , member-declarator where member-declarator corresponds to special declarators and member-declarator-list is one valid part of a member-declaration (for details see the standard). HTH & Greetings from Bremen, Daniel Kr�gler -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: auto_ptr of incomplete type not allowed? Next: set::find with custom equality operator== |