Two constructors, which is default?

后端 未结 6 1523
深忆病人
深忆病人 2020-12-12 02:29

Okay I got a pretty simple assignment.

I got these two constructors for class Person:

Person( const string &, const string &, const string &a         


        
6条回答
  •  猫巷女王i
    2020-12-12 02:56

    If you ask which could be called; that depends on how you create object.

    For example;

    1 - First is called

    Person person = new Person("a","b","c");
    

    2 - Second is called

    Person person = new Person("a","b","c","d");
    

提交回复
热议问题