Objects and Prototypes
2 posts
• Page 1 of 1
Objects and Prototypes
It appears that prototypes do support objects which is great and makes my coding cleaner for sure, but I ran into this strange behanviour:
Can anyone tell me why I am getting the LENGTH ERROR on Bar.x????
- Code: Select all
:class FooClass
:field public x
{del}FooClass
:implements constructor
:access public
x<-''
{del}
:endclass
:class BarClass
:field public x
{del}BarClass z
:implements constructor
:access public
x<-z
{del}
:endclass
Foo<-0{reshape}[]NEW #.FooClass
Foo.x
Bar<-0{reshape}[]NEW #.BarClass ''
LENGTH ERROR
Bar.x
^
Can anyone tell me why I am getting the LENGTH ERROR on Bar.x????
- Erik.Friis
- Posts: 66
- Joined: Mon Apr 04, 2011 3:16 pm
Re: Objects and Prototypes
Well in speaking with Stanley Jordan he suggested that I implement a niladic constructor in BarClass and this seems to work. So it seems that a niladic constructor is invoked on the expression Bar.x where Bar is an empty vector containing an object (class?) prototype.
- Erik.Friis
- Posts: 66
- Joined: Mon Apr 04, 2011 3:16 pm
2 posts
• Page 1 of 1
Return to Object Oriented Programming
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group