Class B
{
    public:
        int e();
        void f();
    private:
        int x;
};

class D: public B
{
    public:
        void h();
        void g();
    private:
        float y;
}

How many public methods does class D have?

is it 2 or 4?

void h(), void g() and i'm not sure about int e() and void f()??

any help plz??

2 -- h() and g().

If you're not sure about e() and f(), You probably need to ask a different question... such as "How many methods does an object of class D have?" .. because then the answer is 4. :)

Or is it more when you consider the default methods added by the compiler, since the author didn't specify them explicitly?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.