Created
October 5, 2013 02:29
-
-
Save Fhernd/6835886 to your computer and use it in GitHub Desktop.
Demostración del uso del modificador de campo readonly en C#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Edad | |
{ | |
readonly int agnioNacimiento; | |
public Edad(int agnio) | |
{ | |
agnioNacimiento = agnio; | |
} | |
public void CambiarAgnioNacimiento(int agnio) | |
{ | |
// La siguiente sentencia causará error de compilación | |
// agnioNacimiento = agnio; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment