Решение:

var myNameSpace = myNameSpace  || {};// создаем пространство имен
 
myNameSpace.myClass = function () {
            var field1 = "text";
            var field2 = 5;
            var func1 = function (txt) {
                
                return field1 + " " + txt;
            };
            return  {
                foo: func1,
                f2: field2
            };
        };
      
        $(function () {
            var obj1 = new myNameSpace.myClass.myClass();
            alert(obj1.foo("ddd"));
            alert(obj1.f2);
        });