Const Methods Are Not Supported

Another restriction you should be aware of is the lack of const methods. It is important to keep this restriction in mind, because it affects other traditional usages of the keyword const. Even though it is possible to define a variable or a parameter of type const TA, it is seldom useful. Due to the lack of const methods, you would not be able to call any method on such a variable. Without casting away the const modifier, you would only be able to assign a new reference to the variable, or to read a const member variable. However, in managed types, you should not define const data members, as the next section explains.

Was this article helpful?

0 0

Post a comment