Learn C++ Oop

by fadikk in Circuits > Software

239 Views, 3 Favorites, 0 Comments

Learn C++ Oop

Screen Shot 2020-11-02 at 11.49.45 AM.png

hi, in this instructable you will learn the basics of c++ oop, hopefully you enjoy!!!!!!

Making a Class

we are going to start by creating a class and naming it Website:

class Website

{

};

Making It Public

now we will add the key word public to the class to make the code we write in the class accesible in other scopes:

class Website

{

public:

};

Creating Our Variables in the Class

now we will create variables in the class (these variables are the atributes of our objects):

class Website

{

public:

//don't forget: #include <string> at the top of your file

string name = "web";

int users = 0;

};

Making an Object

now that we have our class lets make objects out of it:

int main()

{

Website instructable;

return 0;

}

Creating Atributes for Our Object

now we will create atributes for the object using the variables we declared earlier:

int main()
{

Website instructable;

instructable.name = "instructable";

instructable.users = 10000;

return 0;

}

You Finished!!!!

now you finished, hopefully you learned something from this tutorial, well done on completing this instructable!!!!!