digitalmars.D - how use * in D just like C++
- liumao (9/9) Oct 26 2015 for example
- Jakob Ovrum (5/14) Oct 26 2015 `A` on its own is already a reference type. `A*` is a pointer to
for example
class A;
{
void doSomething() {}
}
A *a = cast(A *) new A;
then I call a.doSomething(); my program "Segmentation fault"
how could it happened? and how i use it correctly?
3q, please tell me, 3q 3q 3q!!!!!
Oct 26 2015
On Tuesday, 27 October 2015 at 05:36:58 UTC, liumao wrote:
for example
class A;
{
void doSomething() {}
}
A *a = cast(A *) new A;
then I call a.doSomething(); my program "Segmentation fault"
how could it happened? and how i use it correctly?
3q, please tell me, 3q 3q 3q!!!!!
`A` on its own is already a reference type. `A*` is a pointer to
a class reference, i.e. a pointer to a pointer, like `A**` in C++.
http://wiki.dlang.org/Coming_From/C_Plus_Plus#Slicing_problem
Please use D.learn for questions like this in the future.
Oct 26 2015








Jakob Ovrum <jakobovrum gmail.com>