Skip to content

Instantly share code, notes, and snippets.

@nanase
Created July 30, 2013 16:43
Show Gist options
  • Save nanase/6114674 to your computer and use it in GitHub Desktop.
Save nanase/6114674 to your computer and use it in GitHub Desktop.
D言語を初めて書いてみた。挨拶します。
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