Illegal use of constant and readonly variables. | Lecture 3 - slide 18 : 29 Program 2 |
using System; class ConstDemo { const double ca = 5.0; private readonly double roa = 7.0; private readonly BankAccount roba = new BankAccount("Anders"); public ConstDemo(){ // CONSTRUCTOR ca = 6.0; } public static void Main(){ ConstDemo self = new ConstDemo(); self.Go(); } public void Go(){ ca = 6.0; roa = 8.0; roba = new BankAccount("Peter"); } } | It is illegal to assign to a constant. It is illegal to assign to a constant. It is illegal to assign to readonly variables. |