I know this might be a stupid question. I was trying to make a game with allegro for fun but it getting longer and longer after a while. Now I know I should divide my project to several files instead put all the code at main.cpp.

But how to do this?

Should I have two files for each? One .h and one .cpp ?

I try to find something about OOP and find about class, is class is the separate file I'm thinking?

thx.

There is no one best answer to that question, and every program will be a little different. I would normally put each class in its own header and implementation files, but depending on the size of the class that may not be always necessary either. For non-class functions dividing them up into separate smaller files is somewhat abritrary.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.