โ Back to Encapsulation
Question 468
Init-Only Property
Init-Only Property
Create a classConfigwith astringpropertyNamethat can be set only during object initialization, by using aninitaccessor instead ofset. After construction the value is fixed. Do not write aMainmethod. Fornew Config { Name = "prod" }the program prints: prod
Expected Output:
prod
Topics:
Encapsulation
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.