有如下类和对象的定义:    class Constants{    public:      static double get PI(){return 3.1416;}    };    Constants constants;    下列各组语句中,

admin2009-08-15  19

问题 有如下类和对象的定义:    class Constants{    public:      static double get PI(){return 3.1416;}    };    Constants constants;    下列各组语句中,能输出3.1416的是

选项 A、cout<<constants->getPI();和cout<<Constants::getPI();
B、cout<<constants. getPI();和cout<<Constants.getPI();
C、cout<<constants->getPI();和cout<<Constants->getPl();
D、cout<<constants. getPI();和cout<<Constants::getPI();

答案D

解析
转载请注明原文地址:https://kaotiyun.com/show/REjp777K
0

最新回复(0)