Last time we learned some of the conceptual ideas behind classes and objects. In this lecture will start using classes and objects in a C++ program. The first thing we need to know is, how do we construct an object? How do we use instantiation to get an instance of an object, so that we can interact with that object? So that's what we'll learn how to do in this lecture. This is our starting point for this lecture. So what we're going to do in this lecture is we're going to create a Deck object. Which, under the covers, uses the Deck constructor to create that object into put it into a variable. I need to point out, that all this stuff that we're using, the Deck class and there are actually other things included too like cards and ranks and suits. Those don't come automatically in C++, these are actually in a DLL, a dynamic link library that I wrote to include this reusable code. So this is more like using a library that somebody else provided, but it's not a C++ standard library. It's code that I wrote and I integrated into this visual studio project as dll. So you can't just fire up a new console app and type Deck and expect it to work. Because I've done extra work in this visual studio project to include all the stuff we're using today from that dll. Okay, so we want to create a Deck object. And we need to understand more information about the constructor. We need to know in particular, if the constructor requires us to provide any arguments to initialize the Deck. And the way we find that out is by reading documentation. And here's the documentation for all the stuff that's in the dll that I included in this particular project. How did I get this documentation? I did all the Java doc style commenting that I told you we would do in our code throughout the course. And then I used a tool called Doxygen to generate the documentation from those comments. So this is why we do documentation comments. So that we can generate documentation for users of the code or consumers of the code that we wrote. So over here on the left, I'm going to click on classes and here's a class list. And I'll click on Deck because we're trying to use the Deck constructor. And I'll even Zoom in so that you can see that the public member functions that we have available to us and the Deck class are the constructor. The constructor is always the same name as the class, and then we have an IsEmpty accessory that will look at next time. And then we have four different functions. Cut, Shuffle, TakeTopCard and Print that will actually look at, not next lesson but the lesson afterwards. So what we care about at this point is the constructor. And I can click the constructor and it takes me to the constructor. And it turns out that there are no arguments that I need to provide when I call the constructor. And we know that because there's nothing between these parentheses. Just looking forward, when we cut the Deck, we're going to have to say where we want to cut it. So we're going to have to provide an argument when we call the cut function, and that's shown right here. And there's discussion about that particular parameter. But the constructor doesn't have any of those. So we know we can just use the constructor without providing any additional information. Back in our code, our inclination is to come here and say Deck, For the data type, the class name that we're trying to use, which is Deck And to name our variable. And we're going to name our variable, Deck. So this is okay, It's okay. The compiler can figure out that this is a variable name, But it doesn't know about Deck, the class yet. That's why we have red squiggles. So we regularly find that we need to #include Header files for classes we want to use. So first I'll type the #include and then we'll talk about header files And we'll explore this much more when we are creating our own classes about how we structure header files and cpp files. So all you need to know for now is, when we're using a different class. If it's not already built into a predefined C++ library like this, we need to #include the header file, that in many ways defines the interface to the class. It doesn't have all the implementation details in there, but it does have information about the intervention to the class. So putting the information about the class in two files, the header file and the cpp file. Make it so, we can distribute the header file with our dll. Because people need to know how to use the class. But we keep all the implementation details inside the cpp file, which they don't get when they get the dll. So that's information hiding. They don't get to see the implementation details. Okay, but we still have red squiggles here on line 14. And the reason is, because just as If we type Cout which we've used before, we get red squiggle. But if we provide the namespace for Cout, the red squiggles go away. Sorry, that such technical terminology, So we know Deck from our documentation. Let's go back and take one more look. We know that Deck is actually in the consoleCards namespace, and I've scrolled up and you can see that up here as well. So it's in a namespace that I defined for all the classes that go in the dll. We either need to do this Which fully specifies the name of this class or, as I've shown you before. We can say using namespace consoleCards. And while I did say, when I was talking about using the standard namespace, that I didn't want to do it this way. My general rule will be that if I'm using built in C++ namespaces, I'm going to fully specify them. If I'm using namespaces for code that I've written or sort of custom code, that's not C++ standard code. I'm going to #include using namespace for that particular namespace, because that makes this code easier to read. I'm going to run the code, even though there's nothing at all interesting to see, Just to show you that we can, in fact run the code. And even though it's not obvious, what happens here is, we're actually calling the Deck constructor, which I will tell you actually fills up the Deck with 52 cards. It's not obvious from this syntax that that's what's happening, but that's what's happening. It's calling the constructor to create a Deck object and put it into this Deck variable. To recap in this lecture, you learned how to use a constructor to construct an object