Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8091205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:59:31+00:00 2026-06-05T19:59:31+00:00

I wanted to implement a Node type like written below but I want to

  • 0

I wanted to implement a Node type like written below but I want to hide or protect the properties which aren’t functions so they can’t be over written from outside the class. Is this possible with Mootools hide and protect properties? and what is the difference between hide and protect in Mootools?

var Node = new Class({

    initialize : function(name){
        this.globalId = container.globalId++;
        this.name = name || 'unnamed Node';
    },

    globalId : null,

    siblingId : null,

    name : null,

    parentNode: null,

    childrenNodes : [],

    addChild : function(child){
        //ensure it is a Node object
        if(!instanceOf(child,Node)){
            throw new Exception('Not a Node',this.name+':\nNode.globalId = '+this.globalId+
            "\nAttempting to add a child node that is not a 'Node' type!");
        }
        child.parentNode = this;
        child.siblingId = this.children.length;
        this.children.push(child);
    },

    removeChild : function(child){
        //ensure the child is my child!
        if(child.parentNode !== this){
            throw new Exception('Lost Child',this.name+':\nNode.globalId = '+this.globalId+
            "\nAttempting to remove Node:\n"+child.name+":\nNode.globalId = "+child.globalId);
        }
        this.childrenNodes.splice(child.siblingId,1);
    }

});
Node.globalId = 0;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:59:33+00:00Added an answer on June 5, 2026 at 7:59 pm

    If you need hidden properties, you can get them like this:

    var Node = (function() { 
        var someProperty; // This variable and any others you create here are available only inside this function's scope
    
        return new Class({
            // You have access to those variables here
        });
    }()); // call the function immediately. It returns your new class.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I wanted to implement a loop which is extremely large in thrust but
I have an ImageView for which I wanted to implement the onClickListener. But when
I want to implement a calendar app and wanted to handle recurring events, as
If I wanted to implement a JDBC Driver, how would I know which interfaces/abstract
so I wanted to implement tab views on my app. But I realised the
I'm new to unit testing in general, but wanted to implement it in MVC
I am exploring iOS4.3 SDK & wanted to implement a particular animation effect. But
I wanted to implement an app that prevents calls like a firewall. When I
I wanted to implement lazy loading of variables, but I seem to misunderstand descriptors
I always wanted to implement swypable tabs in my application, like the ones in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.