FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[FIXED] instance without class

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
moechofe



Joined: 07 Oct 2006
Posts: 25
Location: Paris, France

PostPosted: Sun Feb 28, 2010 5:52 am    Post subject: [FIXED] instance without class Reply with quote

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
View user's profile Send private message
moechofe



Joined: 07 Oct 2006
Posts: 25
Location: Paris, France

PostPosted: Sun Feb 28, 2010 6:14 am    Post subject: Reply with quote

Ok, I found it.
I think I have to use makeModule or newNamespace with public function, but the Tutorial Part 7 is'nt ready Wink
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun Feb 28, 2010 9:25 am    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message
moechofe



Joined: 07 Oct 2006
Posts: 25
Location: Paris, France

PostPosted: Sun Feb 28, 2010 10:06 am    Post subject: Reply with quote

Perfect!
I found how to do this in minid.mathlib
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group