This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
im having a time conceptual understanding something that seems so simple.
basically if I have a class CLASS A and it is reading a string that lets say is 100bytes long and I want to make a structure(class B) like this: (using substring) String s1 = to the first 5 bytes String s2 = to the second 5 bytes Byte[] = to the last 90 bytes
I want it to pass this 'structure' to CLASS C and have it be able to take it and make one long string with it again.
what would you pass to CLASS C ? create a new instance and pass it a object of CLASS B?
can anyone show me an example?
thank you [ October 27, 2004: Message edited by: ryan wayne ]
Jimmy Die
Ranch Hand
Joined: Nov 20, 2003
Posts: 97
posted
0
Hi,
I think you're on the right track. Maybe it would look something like this. Of course more is needed...
class A {
public B = b;
public class A() {
b = new B(); }
public void readStringMethod( ...) {
read string stuff; b.setFirstString(); b.setSecondString(); b.setByteArray(); ////(assign everything in b);
}
}
class C {
public B = b2;
public C(B b3) {
b2 = b3;
}
public String getMyNewString(){
/// concatenate your strings and byte array...
return myString; }
}
Jimmy Die
ryan wayne
Greenhorn
Joined: Aug 13, 2004
Posts: 9
posted
0
thank you for your reply,
what is public B = b; is B the class?
so you mean public class B = b; ?
Jimmy Die
Ranch Hand
Joined: Nov 20, 2003
Posts: 97
posted
0
Right that is an error on my part should be
public B b; not public B = b;
Jimmy Die
Ranch Hand
Joined: Nov 20, 2003
Posts: 97
posted
0
same with b2 .
Should be public B b2; not public B = b2.
to many b's...
ryan wayne
Greenhorn
Joined: Aug 13, 2004
Posts: 9
posted
0
thanks. i'll try it out [ October 27, 2004: Message edited by: ryan wayne ]