Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace RTFM
- {
- class Program
- {
- private struct Mutable
- {
- private int x;
- public int Mutate()
- {
- x++;
- return x;
- }
- }
- readonly Mutable m = new Mutable();
- public Program()
- {
- Console.WriteLine("-= Mutating from constructor =-");
- Console.WriteLine(m.Mutate());
- Console.WriteLine(m.Mutate());
- Console.WriteLine(m.Mutate());
- }
- static void Main(string[] args)
- {
- Program t = new Program();
- Console.WriteLine("-= Mutating from Main =-");
- Console.WriteLine(t.m.Mutate());
- Console.WriteLine(t.m.Mutate());
- Console.WriteLine(t.m.Mutate());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement