Hi I am a beginner level c++ programmer and I am trying to learn object oriented programming. I'm quite good with procedural programming(loops, conditionals, switch statements) and I've coded some factorization algorithms as well as a program to grade exam papers (you bung the students test results in and it gives A*/A/B etc.)
I'm now trying to learn about classes and I've made a simple searchable database. Can anyone suggest simple programs to help me learn about how to use classes? (I don't understand constructors and member functions, so would appreciate some help with these concepts.) Thanks.
Learning OOP consists of 2 different parts.
First you need to learn the C++ rules and syntax about classes.
Second you need to learn the concepts about OOP like inheritance, encapsulation....
There are tons of tutorials about this. Just Google "OOP C++" without quotes
I'm currently reading C++ for Dummies and I've read cplusplus.com's documentation. I understand the concepts in theory but I don't understand how to "get my teeth" into classes. Can somebody take me through how to make a default constructor and suggest simple exercises to help me learn how to use them?
class location
{
public:
int x;
int y;
location() // this is the default constructor. Think of it as a function that gets called when you default make one of these objects
{
x = 4;
y = 7;
}
};