Multiple choice

Consider the following code: class A { int i1; protected:int i2; public:int i3; }; class B:public A { Public:int i4; }; class C:B{ }; The variable i2 is accessible

  1. To a public function in class A

  2. To a public function in class B

  3. To a public function in class C

  4. All of the above

  5. Both 1 and 2

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Both 1 and 2 are correct.