Interview Question

2013 Financial Software Engineer Interview New York, NY

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

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

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 Question, Sign In with Facebook or Sign Up