Unity return error message like method not a member of Object class

Hi everyone,

I cant figure out what is wrong with my class. Here is an example:

class One extends Monobehavior{
private var oneNumber : int;
private var twoNumber : int;
public function One(){
}

function setOneNumber() : Object{
oneNumber  = 1;
return this;
}
function setTwoNumber() : Object{
    twoNumber  = 2;
    return this;
}
}
Var one : One;

function Start(){
one = new one().setOneNumber().setTwoNumber();
}

In this case Unity populate error message like setTwoNumber() is not a member of Object class

Your function setTwoNumber returns a reference to an object of type Object. It should return a reference to an object of type One.

function setTwoNumber : One
{
    twoNumber = 2;
    return this;
}

Anyway, you should never call the constructor of a MonoBehaviour-derived class. Start by reading the documentation about programming within Unity.