Created
April 26, 2021 19:55
-
-
Save brianmfear/e2f3e54130eb97d754b586cc8960f772 to your computer and use it in GitHub Desktop.
q341460 example class v1
This file contains hidden or 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
public class q341460 { | |
public String property { | |
get; | |
set; | |
} { | |
property = 'Default Property Value'; | |
} | |
public final String finalProperty { | |
get; | |
set { finalProperty = value; } | |
} { | |
finalProperty = 'Default Final Property Value'; | |
} | |
public static void demo() { | |
q341460 instance = new q341460(); | |
instance.finalProperty = 'New Final Property Value'; // compile error: Final members can only be assigned in their declaration, init blocks, or constructors: finalProperty | |
System.debug('instance.property access getter ' + instance.finalProperty ); // 'New Final Property Value' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment