Doc Comments /
Declaration
Declarations
|
Comments
Is abstract implemented?
It is implemented, it just behaves differently to what you're expecting. From what I can see..
class Parent
{
int foo();
}
class Child : Parent
{
int foo() { return 20; }
}
The above will not compile, *unless* I put 'abstract' in front of the class, or the method 'foo' eg
abstract class Parent
{
int foo();
}
or
class Parent
{
abstract int foo();
}
so abstract allows a class to have undefined method bodies. It does not prohibit instantiation of a class as long as it has all it's method bodies.
I do like the fact that you do not need to place abstract on all the methods of a class, one abstract on the class definition will affect all methods in the class.
I do not like the fact that you cannot provide bodies and still prohibit instantiation of the abstract class.
These are my gut reactions, maybe it's time for a rethink, perhaps D has it right, if a class has all it's method bodies, why prohibit it's instantiation? In which case placing abstract in front of the class or method (with a body) should give an error.
Regan.
Can I get a deeper explaination of synchronized?
I'd like some examples, of where and how to use it. For example, is it per-function synchronisation, or can all the functions in a class be synchronized? I.e, a global lock for all functions within the class.
Is there a more detailed in/out/inout documentation ?
See: Right now I found out by experimenting that
void foo(out char[] x) {
x ~= "content";
}
behaves like
void foo(ref char[] x) {
char[] tmp;
tmp ~= "content";
x = tmp;
}
and I don't even know if I can rely on this behaviour.
Links