Skip to content

Instantly share code, notes, and snippets.

@jyothu
Created Mar 25, 2019
Embed
What would you like to do?
Implement count method - Usage of class variable & instance variable
class Vehicle
end
class Car < Vehicle
end
class Bus < Vehicle
end
class Jeep < Vehicle
end
Jeep.new(name: 'Compass')
Bus.new(name: 'Airavat')
Car.new(name: 'Wagon R')
# implement Vehicle.count and it should return 3 in the above case.
Vehicle.count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment