Object and class relationship
first of all, I have a class called appointment that have get variable(such as Time, Date and STring)method in it, and I have a second class called ListArrayBased. Inside, I have a method that can return an Object.
so
Appointment abc =new Appointment(Time, Date, String)
is ok...
then
ListArrayBased def =new ListArrayBased()
def.insertobject(abc)
ok...here is the question...how can I get the variable/things inside the object
I can't go for...object.getTime() inside the ListArrayBased class to retrieve the Time variable inside the object...what can I do...
[686 byte] By [
saipkjaia] at [2007-9-29 23:46:57]

hi,
u can use get the object from the arraylist by using the getter methods and assign it to a Object pointer of the Class type by typecasting it and then use the object to do whatever u want with it,
u can use something like this
1. int index=def.lastIndexOf(<object>);
2. Appointment abc =(Appointment)def.get(index);
then
3.abc.getTime();
and if u know the index of the object in the arraylist u can skip line 1.
cheers,
hayath
oops. ...sorry i did not see the ListArrayBased class , i mistook it for ArrayList , but even then if it works the same way as an ArrayList it should work,