C++ - Programming Language
This course covers the basics of programming in C++. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

Classes & Objects

Lesson 27
Author : Mike Dane
Last Updated : November, 2017


Code

Copyclass Book{
     public:
          string title;
          string author;
};

int main(){

     Book book1;
     book1.title = "Harry Potter";
     book1.author = "JK Rowling";

     cout << book1.title << endl;

     Book book2;
     book2.title = "Lord of the Rings";
     book2.author = "JRR Tolkien";

     cout << book2.title << endl;

     return 0;
}