#include <iostream>
class Account {
public:
static double GetCircumference(const double &dR) { return 2 * dR * 3.1415926; }
static constexpr double cd = 3.0;
};
// constexpr double Account::cd;
int main()
{
std::cout << Account::GetCircumference(Account::cd) << std::endl;
}
The code is wrong unless I remove the "//". But if I only change (const double &dR) to (const double dR), it becomes ok too. Why?
Aucun commentaire:
Enregistrer un commentaire