Is this program is correct -->using C++0x N3242
A class is a type. Its name becomes a class-name (9.1) within its scope.
class-name: identifi开发者_JAVA技巧er simple-template-id
Class-specifier s and elaborated-type-specifier s (7.1.6.3) are used to make class-names. An object of a class consists of a (possibly empty) sequence of members and base class objects.
class-specifier: class-head { member-specificationopt } class-head: class-key attribute-specifier-seqopt class-head-name class-virt-specifier-seqopt base-clauseopt class-key attribute-specifier-seqopt base-clauseopt class-head-name: nested-name-specifieropt class-name class-virt-specifier-seq: class-virt-specifier class-virt-specifier-seq class-virt-specifier class-virt-specifier: final explicit class-key: class struct union
A class-virt-specifier-seq shall contain at most one of each class-virt-specifier .
A class-specifier whose class head omits the class-head-name defines an unnamed class. [ Note: An unnamed class thus can’t be final or explicit. — end note ]
HERE: they used the --> final, explicit as class-virt-specifier:
for this shall i use like this :
1) struct A{ void f();};
struct B final : A{void f();};
int main() { return 0; }
2) struct A{ void f();};
struct B explicit : A{void f();};
int main() { return 0; }
etc...
Can any one tell the correct usage of thi ...if it is wrong
AND :Please tell me which compiler is going to support this feature.(I know VC++,GCC 4.6.0 is supporting many features) But GCC is not supporting the above feature..Please suggest me what to do to check this?
It looks like it would be ok, but I don't think any compiler implements this yet.
It is also subject to change, as there is a request to remove this:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3234.pdf
精彩评论