Hello guys,
I am trying to “translate” some java code to ruby code for a project in
my univercity. My professor gave me this java code an i want to give him
the same sunctionality in ruby.
Here is the code:
//Classes A and B
class A {
private B ref;
public void m1(){
System.out.println(ref.foo());
}
public void setRef(B aB){
ref = aB;
}
}
class B {
public int foo() {
return B;
}
}
//Creating the objects
A A1 = new A();
B B1 = new B();
A1.setRef(B1);
A1.m1();
This code is creating a connection between the two classes A and B.
I am a little confused about how to write this to ruby.
Any help would be useful!
Thanx in advance
Kostas L.
