I read and understand a lot of russian but I'd rather not try to write it.
Hope answer in english will be of any help to you.

To have private functions and properties you need to use clousure like this:

var AClass = Class.create((function()
{
    var _stat = 'I am static private';

    function initialize()
    {
        this.test = 'I am private';
    }

    function _priv()
    {
        console.log(this.test);
    }

    function _private()
    {
        console.log(_stat);
    }

    return {
        initialize: initialize,

        pub: function()
        {
            _priv.apply(this);
        },

        publi: function()
        {
            _private();
        },

        setpubli: function()
        {
            _stat = 'after set';
        }
    };
})());

document.observe("dom:loaded", function()
{
    var a = new AClass();
    a.pub();
    a.publi();
    a.setpubli();

    var b = new AClass();
    b.publi();
});

Inheritance:

var ASubClass = Class.create(AClass, (function()
{
    function initialize($super)
    {
        $super($A(arguments));
    }

    return {
        initialize: initialize,

        pfun: function()
        {
            console.log('in sub ');
        }
    };
})());


There is much more to explore on this subject.

Have fun





Вот например класс
var  myClass=Class.create (
    initialize :function(){} ,
    action:function ()  {}
)
Метод action публичный(я так понимаю)...а как создать приватный метод
--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/s5jE0forsHgJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.

--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to