Extend class : Class Definition « Dojo toolkit « JavaScript Tutorial






<html>
  <head>
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/"
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
      function FirstName() {
        var firstName = "first";
        this.getFirstName = function() {
          return firstName;
        }
      }
      function LastName() {
        var lastName = "last";
        this.getLastName = function() {
          return lastName;
        }
      }
      function NameOutput() {
        this.sayName = function() {
          alert(this.getFirstName() + " " + this.getLastName());
        }
      }
      dojo.extend(NameOutput, new FirstName(), new LastName());
      var name = new NameOutput();
      name.sayName();

    </script>

  </head>

  <body></body>

</html>








29.44.Class Definition
29.44.1.Extend class
29.44.2.Use dojo to create class
29.44.3.Use package name in function definition