Moose Pickard

Moose Pickard

  • NA
  • 64
  • 69.6k

Call another class's method from a different class, help

Sep 20 2010 2:34 PM
Hi,
me again

I want to call a method from another class.

I have

class Collection {
private List<Car>Cars = new List<Car>();
        public void remove(Car car) {
        Cars.Remove(car);
        }
}

class RentedCar {
        public void ReturnCar(Car car) {
        Collection.Cars.Remove(car;
        }
}

I want to use  Collection class method remove in RentedCar class. How do I do this?

Answers (7)