Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 D: C, C++, Java, Ada, and Eiffel got together and had a kid
Index -> Programming, C++ -> C++ Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wtd




PostPosted: Thu Oct 28, 2004 4:27 am   Post subject: D: C, C++, Java, Ada, and Eiffel got together and had a kid

Quite an interesting language.

http://www.digitalmars.com/d

It interfaces easily with C and C++ code, takes the best of Java and C++ object-orientation, adds some Ada in the form of "in", "out" and "inout" function and procedure parameters, and borrows contracts from Eiffel.

Compilers for Windows and Linux are provided free of charge.

The obligatory "Hello world!" that also prints out any args passed in as a demonstration of array slicing and the foreach loop. Smile

code:
import std.stdio;

int main(char[][] args)
{
   writefln("Hello world!");

   if (args.length > 1)
   {
      writefln("The arguments to this program are:");

      foreach (char[] arg, args[1 .. args.length])
      {
         writefln(arg);
      }
   }

   return 0;
}
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Thu Oct 28, 2004 5:23 am   Post subject: (No subject)

Oh, and it also incorporates ObjectPascal/C# (the guy who developed Delphi at Borland was responsible for designing C#) like "properties".

code:
import sys.stdio;

class Foo
{
   private int m_a;

   public
   {
      int a()
      {
         return m_a;
      }

      int a(int newA)
      {
         return m_a = newA;
      }
   }
}

int main()
{
   Foo f = new Foo;
   f.a = 42;
   writefln("%d", f.a);

   return 0;
}
wtd




PostPosted: Thu Oct 28, 2004 5:45 am   Post subject: (No subject)

And the ease of the Python module system...
Display posts from previous:   
   Index -> Programming, C++ -> C++ Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: