Quick A: Only your own type can be accessed.
Recently on SO:
Accessing protected members in a derived class
You can only access protected members in instances of your type (or derived from your type).
You cannot access protected members of an instance of a parent or cousin type.In your case, the Derived class can only access the b member of a Derived instance, not of a different Base instance.
Changing the constructor to take a Derived instance will also solve the problem.
Add a Comment
Comments are closed.