OOP

///
Last edited on
Any advice would be helpful :)
You could put your code between "code" tags:

[code]
//
// your code goes here
//
[/code]

That should make it easier for other people to see what you are doing.

1
2
3
//
// your code goes here
// 

1
2
3
4
int numberCourseworks = 0;
Module *module = new Module("<< OO Programming >>");

for (int i = 0; i < numberCourseworks; i++) {


How many times does that loop run?

You shouldn't be using new , if it is insisted on being used, each one must have a matching delete, otherwise you have a memory leak. The reason they are bad is if anything throws an exception, the delete is never reached. Much better to use an STL container, they store their data on the heap, and solve the exceptions / memory leak problem.

Did you use it just to obtain a pointer?

could anyone assist me with this or any advice would be appreciated, thank you.


You would get more replies if you asked a proper question. What specifically are you having a problem with? In asking that question, ask yourself what might you do to solve that problem.

If you use the code tags, we can compile you program with cpp.sh the gear icon top right of the code. And refer to line numbers.
www.cplusplus.com/articles/z13hAqkS/

Have you heard of a debugger? It allows one to step through the code line by line, keep an eye on the values of variables, see where it goes wrong, deduce the problem. There should be a GUI one in your IDE.
Topic archived. No new replies allowed.