关键字的作用 修饰构造函数时,阻止复制构造函数

    1. class A
    2. {
    3. public:
    4. explicit A(int i)
    5. {
    6. }
    7. };
    8. void Test(A a)
    9. {
    10. }
    11. int main()
    12. {
    13. A a(5); //ok
    14. A b = 5; //error;
    15. Test(1); //error 不能隐式转换类型
    16. }