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

Struct vs class

Hi guys,

I hope you can help me with this issue. I just thought these day, what actually the difference between classes and structs are.

From what I know right now, the difference is:

-Structs don't need intializer like classes -Structs cannot inheritate data how classes do

But actually, they both have the same goal. They store a specific object with functions and properties in it. That means before I create an object, I have to make sure if I ever will need the information from it again, cause then I have to store it in a class, in order I can inheritate later. Is this, what this whole topic is about?

Thank you!

Br

1 Answer

I understand the frustration on this one, I made a video on this:

https://www.youtube.com/watch?v=0gDKoudMJB4&list=PLZKEWdJPhAAw8CJGPWlEN7tABskIBM0QS&index=7&t=1197s

Hope it helps as this was a tough one for me.