So, I have a lot of the basics down in c++, but the only issue I am having is wrap my head around the idea of a class. I try reading the tutorials on this website, and watch a few youtube videos, but whenever my teacher makes a class, he uses booleans, and it just really throws me off. I was hoping could give me a better idea of classes and their uses. If someone could just comment and give me some tips, I would greatly appreciate it. Thanks much!
Cheers,
Ryan
P.s This is just some homework that I am working on, and struggling with. Lol.
This is actually a 24 hour clock, but without using <time.h>. it's more like just adding and subtracting user inputted hours. I struggle with classes like for this project. I just cannot seem to wrap my head around the concept. Like how would I make a class that adds the user inputted number of hours and minutes?
Classes are like blueprints. They can hold data and functions. The only real special tricks are that any data held by the class is considered in scope for any functions in the same class, and that functions can be made to do things to that data when two instances of the class are used to do math or comparisons. (Aka, a function can determine what happens when you do "obj1 + obj2")
Other than that, a class isn't anything special. Adding user input has nothing to do with classes, but you can put the code that does that stuff into a class if you want.