Let us use Chinese programming
I just thought that C # inside the C # should support Chinese programming, because he supported the unicode of the source code, so he wrote a small program in Chinese, see if it can be compiled, and the result is as I expected, it can be implemented, although the code practical value is not, But it is very fun. I want to teach a Chinese student in such a small program to learn objects, maybe thresholds will be lower, and more interesting, after all, is a native language. (Take a little more correction, use the runtime category identification to determine "Who I")
The source code of the program is:
Using System; Namespace Chinese Programming {Public Class Biology {Public Virtual Void Self Inference () {Console.WriteLine ("I am ... 咦? What? I don't know what I am, anyway, I am a" this .Gettype (). Name);}} public class animal: biological {Protected String mobile method; protected string quantifier = "only"; public animal () {mobile mode = "mobile";} public virtual void mobile () {Console .Writeline ("This" quantifier this.gettype (). Name "in the free" mobile mode environment.newline);} public override void self-introduction () {console.writeLine ("I belong to" THIS .Gettype (). BaseType.name ", I am a" quantifier "cute" this.gettype (). Name);}} public class bird: animal {public bird () {mobile mode = "flying" }}} Public class fish: Animal {public fish () {mobile mode = "swim"; quantifier = "strip";}} public class horse: Animal {PUBLIC HM () {Mobile mode = "Run";Quantifier = "Match";}} Sealed Public Class Run {[Starread] static void main (String [] args) {Biology [] Zoo = New Biology [5]; Zoo [0] = New Bird (); Zoo [1 ] = new fish (); zoo [2] = New horse (); zoo [3] = new animal (); zoo [4] = new creature (); foreach (biological small bioin zoo) {small organism. Self Introduction (); IF (small biological IS animal) {((animal) small organism). Move ();
}}}}} The result of this program is:
D: / project / c # / mytest / Chinese programming. EXE I belong to animals, I am a cute bird, this bird is flying in freedom.
I belong to animals, I am a cute fish this fish to swim freely.
I belong to animals, I am a cute horse this horse in the freedom run.
I belong to creatures, I am a cute animal this animal in the free movement
I am ... 咦? What am I? I don't know what I am, anyway, I am a creature.