02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Classes As Blueprints

Understanding where Objects come from. First stab at understanding what classes are.

Video Transcript

00:00Before we really move into the part where I'm showing you how to code it, another kind
00:07of important, well not kind of, a very important concept in object-oriented programming where
00:14we're not touching it, although we're inside of something that's called a class.
00:19And you can see that there's a keyword here, a class, and we haven't really talked yet
00:23and kind of figured out what our class is.
00:26Just in a nutshell, what are classes?
00:28Classes, you could refer classes to the factory or the creator of objects.
00:37Basically objects need to, someone needs to tell to the object that is being created,
00:42what will it contain?
00:44And the way to do it in an object-oriented way is to basically set it in advance and
00:51set a blueprint for the object that we would create, enabling us to create multiple objects
00:57that would have those characteristics.
00:59So if I would want to reference this to something more in our world, it would be, let's say,
01:05creating a card, a print card that you're going to be sending out to all your friends.
01:13So you created the blueprint, and then you're going to print it out, maybe you worked
01:17on Illustrator or maybe you've ordered online 500 copies of a specific card.
01:23And what you actually did, although not in the programming world, you basically took a
01:27blueprint and created 500 objects, and in that scenario it wasn't an object, but everything
01:34is objects in the world of Flash, almost everything that is.
01:40So now that we know what are objects and we know how they're created, at least in theory
01:45how they're created, we need to know actually what is the syntax that creates objects.
01:51And before we do that, let's just run through again, we're going to go inside of our, oh
01:54sorry, we're going to go inside of our main, and we're just going to create a few variables
01:58from the ones that we've met before.
02:00Let's create a Boolean, we'll call it is true, which would be a Boolean, and we're
02:04going to say that it is true, we're going to give it the value of true.
02:08Let's create one, let's say, UN value, so I'm going to create a variable called I, which
02:15would be a UN, and as we said before, UNs can only accept positive numbers, so positive
02:22full numbers, so we're going to call it 50.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!