Is D so powerfull ??
ZombineDev via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 8 15:43:40 PST 2015
On Saturday, 7 November 2015 at 21:02:26 UTC, Jeremy DeHaan wrote:
> On Saturday, 7 November 2015 at 14:49:05 UTC, ZombineDev wrote:
>> On Saturday, 7 November 2015 at 14:25:01 UTC, ZombineDev wrote:
>>>
>>> What standard C does not provide and D does: calling C++ free
>>> functions nested in namespaces, creating objects of C++
>>> classes (with single inheritance), ...
>> ... calling virtual and non-virtual methods on C++ classes
>> from D
>
> Actually, you can only call virtual methods on classes. Using
> non-virtual methods isn't supported.
Why do you think so?
See: https://gist.github.com/ZombineDev/19f966273b4a82a5c2f1
Output:
$ g++ --version
g++ (Ubuntu 4.9.2-10ubuntu13) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
$ dmd --version
DMD64 D Compiler v2.069.0-b2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
$ ./build.sh
$ ./d_class
cpp.add(40, 2): 42
cpp.mul(1.5, 2f, 'B') 198
$ ./cpp_main
d.add(7, 8): 15
d.mul(3.0, 2.0f, 'A'): 390
More information about the Digitalmars-d
mailing list