The compiler will generate an error
The Type or Namespace 'B' could not be found.
It is because since B is the inner class, it is now private.
1)we have to change the access modifier of B to internal/public
2)we have to give the full path of class B when creating the object
i.e. A.B obj=new A.B();
Then we can see the value of the field str in the output.
Asked In: Many Interviews |