shared - i need it to be useful

Neia Neutuladh neia at ikeran.org
Tue Oct 23 01:21:32 UTC 2018


On Tue, 23 Oct 2018 00:08:04 +0000, 12345swordy wrote:
> Quick question, if a class import a module in its scope, does it carry
> its own copy when creating multiple objects with it?

Importing a module doesn't make a copy of any code. Each module contains 
only its own code. Importing modules makes it so you can access their 
code, nothing more.

Instances of a class don't contain private copies of their own code. 
There's only one copy per executable. So even if importing a module made a 
copy of the code, you'd still only have one copy per type, not per object.


More information about the Digitalmars-d mailing list