Dhort intro to D-5W1H

Dhort intro to D-5W1H - The 5W1H of D Programming Language...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The 5W1H of D Programming Language 2005/10/06 H ð ‚ “ (Kazuhiro Inaba)  http://www.kmonos.net/ What is D? What is D? Multi-Paradigm Language Object-Oriented Programming Generic Programming (via templates) Compiled Native code No VM, No Iterpreters Statically-Typed What is D? Garbage Collected Unicode Based Binary Compatible with C Looks and Feels very much like C/C++ Code Example: Hello World import std.cstream; int main( char args ) { dout.writefln( “Hello, World!” ); return 0; } Code Example: Classes interface Animal { char speak(); } class Dog : Animal { char speak() { return “woof”; } } class Cat : Animal { char speak() { return “meow”; } } Code Example: Classes int main() { Animal animals; animals ~= new Dog(); animals ~= new Cat(); foreach( Animal a ; animals ) dout.writeLine( a.speak() ); return 0; } Class Encapsulation public, protected, private Inheritance Single Inheritance Multiple Interfaces Mix-in ‘class Object’ at the root of the hierarchy Pretty Much Like Java & C#! (except mix-ins) Class Property (like C#) Setter/Getter as if it were a field Operator Overloading (like C++,C#) a+b a.opAdd(b) Code Example: Templates class Stack(T) { private T data; public void push(T e) { data ~= e; } public T pop() { T e = data[$-1]; data.length = data.length-1; return e; } } Code Example: Templates int main() { Stack!(int) s = new Stack!(int)(); Stack!...
View Full Document

This note was uploaded on 04/15/2011 for the course MAT A-239 taught by Professor Maximojimenex during the Fall '08 term at SUNY Adirondack.

Page1 / 46

Dhort intro to D-5W1H - The 5W1H of D Programming Language...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online