关于javaScript对象有关问题

关于javaScript对象问题
//  定义一个类
function Set(){
this.values = {};
this.n = 0;
this.add.apply(this, arguments);
}

//  将方法add作为Set的原始方法
Set.prototype.add = function(){
for(var i = 0; i < arguments.length; i++){
var val = arguments[i];
var str = Set._v2s(val);
if(!this.values.hasOwnProperty(str)){
this.values[str] = val;
this.n++;
}
}
};
//  将值转成字符串
Set._v2s = function(val){
switch(val){
case undefined : return 'u';
case null : return 'n';
case true : return 't';
case false : return 'f';
default : switch(typeof val){
case 'number' : return '#' + val;
case 'string' : return '"' + val;
default : return '@' + objectId(val);
}
}

function objectId(o){
var prop = "|**objectid**|";
if(!o.hasOwnProperty(prop)) o[prop] = Set._v2s.next++;
return o[prop];
}
};
Set._v2s.next = 100; //  设置默认值
//  创建继承的方法
function inherit(p){
if(p == null){
throw TypeError();
}
if(Object.create){
return Object.create(p);
}
var t = typeof p;
if(t !== "object" && t !== "function"){
throw TypeError();
}
function f() {};
f.prototype = p;
return new f();
}
//   定义子类
function filteredSetSubclass(superclass, filter){
var constructor = function(){
superclass.apply(this, arguments);
};
var proto = constructor.propotype = inherit(superclass.prototype);
proto.constructor = constructor;
proto.add = function(){
for(var i = 0; i < arguments.length; i++){
var v = arguments[i];
if(!filter(v)) throw ("value " + v + " rejected by filter");
}
superclass.prototype.add.apply(this, arguments);
};
return constructor;
}

var StringSet = filteredSetSubclass(Set, function(x){return typeof x === "string";});
var stringSet = new StringSet();
//  执行这个方法的时候报错:Cannot read property 'apply' of undefined
stringSet.add("1");

本人最近在学习javaScript,上面是我学到的知识,不明白执行stringSet.add("1");为何会报错
求大神们指导。。。
------解决思路----------------------

//   定义子类
function filteredSetSubclass(superclass, filter) {
    var constructor = function() {
        superclass.apply(this, arguments);
    };
    /*---------------------------------

    var proto = constructor.propotype = inherit(superclass.prototype);
    //  propotype => prototype 
      ---------------------------------*/
    var proto = constructor.prototype = inherit(superclass.prototype);

    proto.constructor = constructor;
    proto.add = function() {
        for (var i = 0; i < arguments.length; i++) {
            var v = arguments[i];
            if (!filter(v)) throw ("value " + v + " rejected by filter");
        }
        superclass.prototype.add.apply(this, arguments);
    };
    return constructor;
}