Want a Free Job Posting?

Buy a job posting today and the second one is on us. For a limited time only. Act Now.

Interview Question

Interview New York, NY

class A{ void foo(); } class B{void foo1(); } class C {void

  foo1(); } Design like below: B.foo1() can access A.foo(), but C.foo1() can not access A.foo()

Interview Answer

2 Answers


class A{ protected: void foo();} class B : class A{ foo1();}

Interview Candidate on Apr 23, 2013

class A { private: void foo(); friend class B;}; class B { void foo1(); } class C { void foo1{};

Xiaoge Su on Jul 15, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.