Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Namespace addition
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using NameSpaceExample; namespace NameSpaceExample { class CountDown { int val; public CountDown(int n) { val = n; } public void Reset(int n) { val = n; } public int Count() { if(val > 0) return val--; else return 0; } } } namespace NameSpaceExample { class CountUp { int val; public CountUp(int n) { val = n; } public void Reset(int n) { val = n; } public int Count() { if(val<25) return val++; else return 0; } } } namespace Rextester { public class Program { public static void Main(string[] args) { // Notice how CountDown is qualified by Counter. //NameSpaceExample.CountDown cd1 = new NameSpaceExample.CountDown(10); CountDown cd1=new CountDown(10); int i; do { i = cd1.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); // Again, notice how CountDown is qualified by Counter. CountUp cd2 = new CountUp(0); do { i = cd2.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); cd2.Reset(4); do { i = cd2.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); } } }
run
|
edit
|
history
|
help
0
Dungeon Game
hi
1234
sxsadxasxd
radix sort
mine
Viktor's example
5555555
Uri Parts
a.i. neural framework / J.A.R.V.I.S. / Just A Rather Very Intelligent System