Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

What are instances and classes really confuse

I need video links or documentation which could help me what are classes and instances in ruby.

Your help would really appricatated

2 Answers

Michael Wiss
Michael Wiss
19,233 Points

Umair,

    Classes create objects and instance variables store the state of the object.  

   Codeacademy has a great course on Ruby: 

    http://www.codecademy.com/en/tracks/ruby

Appreciate your effort and help

Consider This

A Car is a class - all cars have some basic setups - an engine, a color, tires, breaks, transmission. However, some of those can have different options (manual versus automatic transmission).

When you instantiate an instance of a class you are creating a unique object that is a member of that class. Your car is an instance of the car class - it has a specific engine, color, tires, break types, transmission, etc...all those things could be considered the variables FOR the class and YOUR cars engine, color, tires, break types, transmission etc are the instance variables for your car.

Lynda.com has a great series in the fundamentals of programming with Simon Allardice and there is one devoted to Object Oriented Programming, both the principles AND designing. It's language neutral, which I feel is important because the principles are the same across most OOP languages, but the implementation is different.

Thanks really appreciate it.