Couple
次の 2 つのコンストラクター シグネチャが与えられた場合、 withを構築することは可能Couple("George", "Nora")
でしょうか? 私のコンパイラは、以下に示すエラーで文句を言います。私がそれを呼び出すと、Couple(std::string("George"), std::string("Nora"))
コンパイルはOKです。char* から string への変換は問題ないと思うので、暗黙のキャストに問題があると思います。
class Person
{
public:
Person(const std::string& name);
};
class Couple
{
public:
Coordinate(const Person& p1, const Person& p2, const Optional<Person>& = Optional<Person>());
};
TestCouple.cpp:69: error: no matching function for call to `Couple::Couple(const char[7], const char[5])'
TestCouple.h:24: note: candidates are: Couple::Couple(const Person&, const Person&, const Optional<fox::Person>&)