Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell
- {
- public static class Program
- {
- public static void Main()
- {
- var data = new Data();
- Console.WriteLine(data);
- data++;
- Console.WriteLine(data);
- data = data.Next;
- Console.WriteLine(data);
- data++;
- Console.WriteLine(data);
- }
- class Data{
- public Data Next{
- get{
- if(_next == null)
- _next = new Data();
- _next._previous = this;
- return _next;
- }
- }
- public Data Previous{
- get{
- return _previous;
- }
- }
- private Data _next;
- private Data _previous;
- private byte Value = 48;
- public static Data operator ++(Data data){
- data.Value++;
- return data;
- }
- public static Data operator --(Data data){
- data.Value--;
- return data;
- }
- override public string ToString(){
- return ((char)Value).ToString();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement