On Jul 22, 2006, at 7:50 AM, Phil M wrote:

On Jul 21, 2006, at 8:52 PM, Norman Palardy wrote:

I think all they are saying is to create several regular method definitions for your class. Just name them "Constructor"

Well, one of the other things that I am confused about is declaring the method. Does the name of the method in C have to be the same as the "description" written in the REALmethodDefinition? (all examples I have seen have shown the same name). I tried naming my C methods "Constructor" but I had some sort of compile error.

A REALmethodDefinition maps a C-function to a RB method declaration. So if you define a method map like

{ (REALproc) MyCMethodConstructor, REALnoImplementation, "Constructor (p As Picture)" },

Then the user can only instantiate your class with: myClass As yourClass = new yourClass(p). By defining a single constructor in the REALmethodDefinition you also automatically disable the default ability to call "new yourClass()".



A constructor in RB is just a method anyways

I currently am trying to have three constructors (though I would rather have two with a default value). The problem is that the constructor that I really want to use takes a Picture as a parameter and all attempts to use this constructor have crashed.

Then you do something wrong elsewhere.

It is all so confusing... like Christian said:

"Over time you will learn that the RB SDK is a lot of guessing and trying."

Yeah. It is not like the rest of the REALbasic experience, that is for sure. Does anyone have a list of open-source plugins that I can take a look at the source code? Other than that, all I can do is take a look through the archives and ask questions to this list.


It is like an RB experience... And just forget about the "Initializer" and "Finalizer" declarations. Those are never exposed to the user of your plugin. They are only meant if you need to do things under the hood. For example you need to allocate memory, respectively deallocate memory. If it is a simple struct you are dealing with, then the initializer and/or finalizer can be nil.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to