Class is basically a set of codes about an object
Once you become a programmer, you will be writing a lot of codes for applications. The more applications you build the more and more codes you will write.
Perhaps the best way to get you to understand what classes or a class is, is to find out why does a class exists?
As you write more codes after codes, you will begin to notice that some of the codes you are writing are actually the same codes you have written in the past.
Wouldn't it be nice to not rewrite the same code over and over? It is possible to not rewrite the same codes over and over by writing (coding) it once and package it up into "something special".
So when you need to reuse that code again, you don't have to rewrite it again. All you have to do is to call-a-copy-of-it from that "something special". To call-a-copy-of-it ( "it" refers to the 'something special' ) in programming lingo is to instantiate.
That "something special" in programming terminology is called a class. A class is an already-made-code(s) that can be re-used in your application simply by calling its name.Once a copy is made from the original class it is considered an instance of that class-meaning it inherits (copied) everything (functions, methods, properties, events) in the class.
The functions that a class can have varies, or depend on what class you build. Because classes can represent anything (objects) in the real world-physical or abstract- they may have different function, methods, properties and events in them.
But first let me try to make it easier for you to understand what is a function at its basic.
Function falls along class for the fact that they are also packaged codes. Reusable (By calling its name) codes so you don't have to spend more time coding or writing the same code.
A comparable great example of class is a blueprint of a house.
This blueprint can be re-use to build many houses that look exactly the same. In other words:
This class (blueprint) can be instantiated (followed or copy) to make instances (copies of blueprint in it physicality) of this class.
-----------------------------------------------------
Lets build a simple house using pseudo codes:
-----------------------------------------------------
1.Build a foundation
2.Build the north wall
3.Build the east wall
4.Build the south wall
5.Build the west wall
6.Build the roof
->Now we just code an object by writing codes.
You can build the same exact house as many times as you want by coding or rewriting the same codes 1-6 over and over. But why do all that tedious and repetitive coding when you can package all those up into a class and simply call or instantiate the class. Ok, lets turn or package up those codes into a class.
Class BuildASimpleHouse
1.Build a foundation
2.Build the north wall
3.Build the east wall
4.Build the south wall
5.Build the west wall
6.Build the roof
End Class
Now if you want to build the same house again and again?
Instead of coding the same codes over and over, all you have to do is call that class or instantiate it.
Lets build 6 houses without rewriting the 1-6 set of codes 6 times:
Examples in pseudo codes:
House1 as New BuildASimpleHouse
House2 as New BuildASimpleHouse
House3 as New BuildASimpleHouse
House4 as New BuildASimpleHouse
House5 as New BuildASimpleHouse
House6 as New BuildASimpleHouse
Class is basically a set of codes about an object.