简体   繁体   中英

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: identifier 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM