I have an extremely simple class that I just started writing, and it's already gone wrong. The following gives me a compiler error:
init (foo: Int, bar: Int, bat: Float) {
self.foo = foo
self.bar = bar
self.bat = bat
self.extra = 12345
}
There is no superclass, so I'm not allowed to call super.init().
The error I get is:
'self' used in property access 'foo' before all stored properties are initialized
Well OK, how am I supposed to initialize stored properties before I initialize stored properties?
Foo and bat both have getters and setters, but bar and extra do not.
How to understand what's going on?
I've never gotten thwarted with such simple code in C, C++, Python or anything else really.