class Man 
{
    string name;
    string height;
    string education;    void Work()
    {
        cout << "i am " << name << "my height is " << height << "my  education is" << education;
    }
}

解决方案 »

  1.   

    这样:var Man=function(n,h,e) {
        this.name=n;
        this.height=h;
        this.education=e;
    }
    Man.prototype.Work=function() {
        document.write("i am "+this.name+" ,my height is"+ this.height+ ",my education is"+this.education);//如果是load以后换行换成alert
    }var m=new Man("sohighthesky",175,"X");
    m.Work();
      

  2.   

    现学现卖
    function Man()
    {
        var name = "";
        var height = "";
        var education = "";    this.Work = function ()
        {
            alert("i am " + name + "my height is " + height + "my  education is" + education);
        }
    }调用:
    var obj = new Man();
    obj.Work();