有如下类声明: class TestClass { inti; private:intj; protected:int k; public:int m,n; }; 其中,私有成员的数量为___

admin2012-12-29  30

问题 有如下类声明:
    class TestClass
    {
    inti;
    private:intj;
    protected:int k;
    public:int m,n;
    };
    其中,私有成员的数量为__________。

选项

答案2

解析 首先声明为privace的“pfivate:int j;”中j为私有成员。然后在类中没有指定,系统默认为私有。即“int i:”中的i也是私有成员。所以本题中的私有成员数量为2。
转载请注明原文地址:https://kaotiyun.com/show/N5Vp777K
0

最新回复(0)