7
Reply

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

Moose Pickard

Moose Pickard

Sep 20 2010 2:34 PM
2.1k
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)