#2172 creating a new object/ instantiating a class

pomeroja Tue 16 Jul 2013

I am definitely missing something... everytime i try to instantiate a class it tells me expected expression, not new. I feel stupid asking this but searching for new or instantiating doesnt fair very well in the search...

in java

Rectangle rectOne = new Rectangle(100, 200);

could someone please point me to the area in the docs or show me a simple example?

SlimerDude Tue 16 Jul 2013

Try:

rectOne := Rectangle(100, 200)

Fantom doesn't use the new keyword.

SlimerDude Tue 16 Jul 2013

Yeah, I had a quick nose around the docs and you're right - it's not obvious!

I did find this ctor section in docIntro though which links through to the ctor methods in docLang. The docLang section is fairly comprehensive (but hard to find!).

pomeroja Tue 16 Jul 2013

Well thanks for the quick response. Tested it and it works. Now that i actually look at the docs and the post you posted it becomes obvious... Thanks

Login or Signup to reply.