Hey all,

So I'm new to Javascript, but I've been working on a programming language with similar semantics to C#, and I want to add a JS trans-compiler. I've been looking through various ways of achieving OOP in Javascript, but I'm not entirely sure if it's going to work further down the line.

Let me start with an example. Here's a very simple bit of code in my language:

Code:
// test.fd
// this code will be put in package 'test'
class Foo
{
    float bar;

    - test
    {
        int x = 3;
    }
}
It outputs this:
Code:
var test = {
    function Foo(){
        this.bar = 0.0;
    };

    foo.prototype.test = function(){
        var x = 3;
    };
}

Now I have a few of questions. Currently, when it compiles the class it creates the js function 'Foo()', which I see is really behaving as a constructor. I'm thinking I should create this by default if the user doesn't create a default constructor, in which case it is used. But what if I wanted to have multiple constructors for the same class? Will they have to have different names, and will I have to recreate all methods and properties for each constructor?

My next question is, what is the best way to achieve inheritance in JS? My language assumes all methods are virtual so it should hopefully make polymorphism easier.

Thanks all,
Zotoaster