Re: (Noob question) Should subclasses be defined in separate modules?

2023-01-12 Thread Mike Parker via Digitalmars-d-learn
On Friday, 13 January 2023 at 05:17:59 UTC, thebluepandabear wrote: (Sorry if this is a duplicate.) If I have the following code inside of a module: ```D class Obj { private { string name = "Hi"; } } class ObjDerived : Obj { } ``` Is it best practice to define `ObjDerived` in

Re: Noob question about structs allocation

2018-10-15 Thread Mike Parker via Digitalmars-d-learn
On Monday, 15 October 2018 at 04:14:24 UTC, IM wrote: What is the effect of calling destroy? - calling the destructor? - deallocating the memory? - both? It calls the destructor. The GC will deallocate the object's memory later. However, you need to be careful about how you use GC-allocated

Re: Noob question about structs allocation

2018-10-15 Thread Laurent Tréguier via Digitalmars-d-learn
On Monday, 15 October 2018 at 04:14:24 UTC, IM wrote: What is the effect of calling destroy? - calling the destructor? - deallocating the memory? - both? IIRC, it only calls the destructor, the GC will decide when to deallocate the memory.

Re: Noob question about structs allocation

2018-10-14 Thread IM via Digitalmars-d-learn
On Monday, 15 October 2018 at 03:33:04 UTC, Basile B. wrote: On Monday, 15 October 2018 at 03:19:07 UTC, IM wrote: I probably used to know the answer to this question, but it's been a long time since I last used D, and I don't remember. Suppose we have: struct S { int num; } Would allocati

Re: Noob question about structs allocation

2018-10-14 Thread Basile B. via Digitalmars-d-learn
On Monday, 15 October 2018 at 03:19:07 UTC, IM wrote: I probably used to know the answer to this question, but it's been a long time since I last used D, and I don't remember. Suppose we have: struct S { int num; } Would allocating an instance on the heap using: S* s = new S; use the GC,

Re: noob question

2009-08-07 Thread llltattoolll
thx sergey my example work correctly now :D

Re: noob question

2009-08-06 Thread Sergey Gromov
Thu, 06 Aug 2009 10:56:33 -0400, lllTattoolll wrote: > hi Lars and thx for help. I fix a little the first problem, now I paste a > verion in english whit coment because i´m lost here. > the example is the same only this is in english for your compresion of my > problem. > >

Re: noob question

2009-08-06 Thread BCS
Reply to llltattoolll, writefln ("Your age is %d? \t YES \t NO", _age ); /* here is my second problem, can´t into the response and program*/ _response = readln(); /* show me else line always */ // if all else fails, what are you getting writef(">>%s<<\n", cast(ubyte[])chomp(_response));

Re: noob question

2009-08-06 Thread lllTattoolll
hi Lars and thx for help. I fix a little the first problem, now I paste a verion in english whit coment because i´m lost here. the example is the same only this is in english for your compresion of my problem. -- code --

Re: noob question

2009-08-06 Thread Lars T. Kyllingstad
Lars T. Kyllingstad wrote: llltattoolll wrote: hi im noob here and try learn D language, i try make this example but when run have 2 problems. 1) when i show name and lastname show me in two lines and i wanna make in the same line. 2) can´t validate option si ( yes ) or no ( no ) and always s

Re: noob question

2009-08-06 Thread Lars T. Kyllingstad
llltattoolll wrote: hi im noob here and try learn D language, i try make this example but when run have 2 problems. 1) when i show name and lastname show me in two lines and i wanna make in the same line. 2) can´t validate option si ( yes ) or no ( no ) and always show the else line. what hap