View previous topic :: View next topic |
Author |
Message |
moechofe
Joined: 07 Oct 2006 Posts: 25 Location: Paris, France
|
Posted: Sun Feb 28, 2010 5:52 am Post subject: [FIXED] instance without class |
|
|
Hi,
Is it possible to have a global instance in MiniD but not access to the constructor of the class.
sorry for my english.
Example :
Code: | myobject.callFunction() // OK, myobject is already instanciate in D
local another = MyObject() // NOT OK, MyObject is not defined
|
Last edited by moechofe on Sun Feb 28, 2010 10:15 am; edited 1 time in total |
|
Back to top |
|
|
moechofe
Joined: 07 Oct 2006 Posts: 25 Location: Paris, France
|
Posted: Sun Feb 28, 2010 6:14 am Post subject: |
|
|
Ok, I found it.
I think I have to use makeModule or newNamespace with public function, but the Tutorial Part 7 is'nt ready |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Sun Feb 28, 2010 9:25 am Post subject: |
|
|
Yes, if it's a singleton, a namespace/module is the way to go here. The problem with an instance is that even if you don't expose the class explicitly, you can still use "myobject.super()" to get a new instance of the class. |
|
Back to top |
|
|
moechofe
Joined: 07 Oct 2006 Posts: 25 Location: Paris, France
|
Posted: Sun Feb 28, 2010 10:06 am Post subject: |
|
|
Perfect!
I found how to do this in minid.mathlib |
|
Back to top |
|
|
|