ofeet
February 26th, 2009, 02:36 PM
is there such a thing? it's either this or "for each"
pretend I have 6 red cars and 14 blue cars in my ParkingLot class. I want ParkingLot to tell just the red cars to drive.
In my mind it works as follows:
for each(var car in cars_Array) {
if(car is RedCar){
car.drive();
}
}
thoughts?
pretend I have 6 red cars and 14 blue cars in my ParkingLot class. I want ParkingLot to tell just the red cars to drive.
In my mind it works as follows:
for each(var car in cars_Array) {
if(car is RedCar){
car.drive();
}
}
thoughts?