Skip to content

Instantly share code, notes, and snippets.

@jyothu
Created March 25, 2019 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyothu/bf072698c704fc54ccccd397773ee63f to your computer and use it in GitHub Desktop.
Save jyothu/bf072698c704fc54ccccd397773ee63f to your computer and use it in GitHub Desktop.
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