1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var Child, GrandChild, Parent, felix;
Parent = function(proto) {
  var public1, self;
  self = Object.create(proto);
  public1 = function() {
    console.log("in public1 with self: ", self);
    return console.log("in public1 with name: ", self.name);
  };
  self.public1 = public1;
  return self;
};
Child = function(proto) {
  var private1, public2, self;
  self = new Parent(proto);
  private1 = function() {
    console.log("in private1 with self: ", self);
    console.log("in private1 with name: ", self.name);
    return self.public1();
  };
  public2 = function() {
    console.log("in public2 with self: ", self);
    console.log("in public2 with name: ", self.name);
    return private1();
  };
  self.public2 = public2;
  return self;
};
GrandChild = function(proto) {
  var public3, self;
  self = new Child(proto);
  public3 = function() {
    console.log("in public3 with self", self);
    console.log("in public3 with name: ", self.name);
    return self.public2();
  };
  self.public3 = public3;
  return self;
};
felix = new GrandChild({
  name: "Felix"
});
felix.public3();