Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Using PHP with MySQL Connecting PHP to MySQL Introducing Classes

what 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

That 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 ^^;

Thanks .. You help me bro and ur comment was completly true

Glad I could help :) Writing about it that way helped me to understand it a little better too :)

Hmmm, 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 :)

Thanks ur Comment Help me alot ♥ i undesrand it :)