954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How many public methods does class D have?

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??

jack223
Light Poster
27 posts since Nov 2005
Reputation Points: 10
Solved Threads: 0
 

2 -- h() and g().

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

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. :)

Bench
Posting Pro
577 posts since Feb 2006
Reputation Points: 307
Solved Threads: 63
 

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

Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You