Hi Again,

I want to use the prototype Class.Create feature, because of the
inheritance implementation.
The Problem with this procedure of wrapping the class.create code in
an anonymous function, is that that
these private members are also private if the super method is called
from the inherited class.

var BaseClass = (function()
{
        var _myPrivateMember = 5;

        return Class.create(
        {
                initialize: function(id)
                {
                },

                // add public methods here
                myPublicMethod: function()
                {
                        alert(_myPrivateMember);
                }
        });
})();


// inherit from BaseClass
var InheritedClass = (function()
{
        return Class.create(BaseClass,
        {
                initialize: function()
                {
                },

                // override, from base class
                myPublicMethod: function($super)
                {
                        // do some stuff
                        $super();
                        // calls method from super class, but the superclass
                        // method does not know its privat member any more
                }
        });
})();


If I call myPublicMethod from the inherited class, it tries to call
the method of the baseclass.
Unfortunetaly the Method of the baseclass doesn't know the
privatmember anymore.

That is, why I was asking, if their is a best practice method for
private methods with inheritance in prototype.

I would really appreciate if their was a solution for this :(

cheers
Dean
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to