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

iOS

What is a "Class"?

Hey All. The videos have started talking about "classes" quite a bit in the first video on Objective-C, talking about how the class is split amongst the .m and .h files. Can someone please define what they mean by "Class" Thanks!

2 Answers

Every single teacher I've had, explained this with the same example. Imagine you have a car, a car has many properties like wheels or engine and methods like starting the car. But there are cars that have different properties and different methods. So we create another class, for example BMW. It is still a car, and inherits from this class but it has other properties just for itself. In Objective-C we have NSObject, that would be the car from this example, and NSString, a class that inherits from NSObject that describes the behavior and properties common to a particular type of object, strings.

This is just an example for understanding the concept but I hope you find it useful.

Thank you so much Enara L. Otaegi !