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 trialimad saci
Courses Plus Student 173 Pointswhat is the deference between class and object ? google traduction Didn't help me on that :v and thanks
i didn't understand when he said "php mailer object is instantiate a class mailer" ?
2 Answers
William J. Terrell
17,403 PointsThat particular video confused me as well. From the transcript, though, I've pulled the following:
"An object is a complex variable type that bundles other variables and functions together into a single unit. Those variables are called "properties" of the object and those functions are called "methods" of the object."
Which, if we break it down:
1.) an Object is a Variable 2.) an Object bundles other variables and functions into a Singularity 3.) The variables that get bundled are then called Properties 4.) the functions that get bundled are then called Methods
Then there was this bit:
"In PHP, a class is a type of object, or an object definition. The class defines what properties and methods will exist inside any objects of that class. Each object is said to instantiate its class, which means it is a real instance made from that class."
Which, if we break it down:
1.) A Class is what you use to define an Object 2.) A Class is what you use to define which Properties and Methods are defined in that Object.
So, what I think that means is that, you can use a Class to define variations of Objects.
For example, if you had an Object called "Cat", you could use one Class to define one instance of Cat as having a Property of "Black Fur", and another Class to define another instance of Cat as having a Property of "White Fur".
You could also use Classes to define Methods (functions) on each instance of "Cat". So you could use the Class that says "This instance of 'Cat' has 'Black Fur'" to also say "The 'Cat' with 'Black Fur' 'eats Dry Food'." (where 'Black Fur' is the Property and 'eat Dry Food' is the Method). You could use another Class that says "The 'Cat' with 'White Fur' 'eats Wet Food'." (where 'White Fur' is the Property and 'eats Wet Food' is the Method).
At least I think that is what is going on here... I apologize if I am just over-complicating things ^^;
thomascawthorn
22,986 PointsHmmm, that's quite a tricky one to explain easily. You create an object from a class. A class is like a blueprint for a house, and when you say 'new House' you're building a new house from the blueprints.
If you haven't already watched it, maybe this course might help you understand it better :)
imad saci
Courses Plus Student 173 PointsThanks ur Comment Help me alot ♥ i undesrand it :)
imad saci
Courses Plus Student 173 Pointsimad saci
Courses Plus Student 173 PointsThanks .. You help me bro and ur comment was completly true
William J. Terrell
17,403 PointsWilliam J. Terrell
17,403 PointsGlad I could help :) Writing about it that way helped me to understand it a little better too :)