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
NOUR A ALGHAMDI
Courses Plus Student 5,607 Pointsi'm a little confused !!
hey avery one . . . i wanted to ask about struct ! won't be better if we use class instead of struct ! and please tell me what is the difference between them !
2 Answers
Ashleigh Nombre
2,308 PointsDepends on what you need each for use this to decide. Making a decision for an app which has a data model. You would want to use a struct the reason behind this is struct is used for simple data. When you are using primitive types like strings use a struct. If you want to inherit other methods and properties i.e... if you are creating a game and you have a EnemyTower and you want a LaserTower you can inherit the initial EnemyTower class and override the properties in that class and create a LaserTower. The significant difference is how you use them in your idea of code.
Ashleigh Nombre
2,308 PointsI also have a skype if you have any questions Ashleigh.Nombre
NOUR A ALGHAMDI
Courses Plus Student 5,607 Pointsthank you Ashleigh Nombre i am grateful for your help , i'll follow you if i need to :)