Created
July 30, 2013 16:43
-
-
Save nanase/6114674 to your computer and use it in GitHub Desktop.
D言語を初めて書いてみた。挨拶します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
void main() | |
{ | |
writeln("Hello, world!"); | |
Person kawachi = new Person(16, "Shinichi Kawachi"); | |
kawachi.greeting(); | |
} | |
class Person | |
{ | |
int age; | |
string name; | |
this(int age, string name) | |
{ | |
this.age = age; | |
this.name = name; | |
} | |
void greeting() | |
{ | |
writefln("My name is %s, I am %d years old.", this.name, this.age); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment