Machine-translated by Google. Questions are authored in English.
Top

Discussion

An inner declaration that hides an outer one of the same name is said to

  • A.overload the outer declaration with an additional meaning
  • B.override the outer declaration permanently for the whole program
  • C.alias the outer declaration so both refer to one location
  • D.shadow the outer declaration for the extent of the inner block

Answer: D

Shadowing is temporary and lexical: the outer declaration becomes visible again on leaving the block. Overloading and aliasing are quite different relationships between names. Confusing the three is one of the commonest terminological errors in this area.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.