I'm porting some code from Java (I know nothing about this language) to C. By the fact that Java is a C-like language, I have no problem in converting most statements. But I have no idea what some parts of the code mean. It calls a java class as a function and pass as parameter:
Assume the classes to be:
public class foo {
public foo(Typex x) { //etc }
}
public class baa {
public baa(Typex x) { //etc }
}
From another class it's called as: new foo(baa())
What does it mean?
This is wrong ! new foo(baa())
You cannot do this in Java, instead what you need to do is
new foo(new baa().bar()) .
This means you first create a reference (Object) of baa and call bar() method of that reference. Remember new keyword in Java is to create a new reference out of a class. It calls a Constructor method of the class and allocates memory for that reference.
Further in above case it passes whatever returned from bar() method as an argument to the foo class and in turn create a reference of foo class too.
This is a good start : [1]: http://docs.oracle.com/javase/tutorial/java/javaOO/index.html