I see use of pointers and manual memory management in this (new, delete); this is, broadly speaking, bad. This is something that should be done only when necessary, and in this case it's very much not necessary.
I see arrays being used here. Much the same comment; should be used only when you have to, and here, you definitely do not have to.
1 2 3 4 5 6
|
// BAD
object *objects=NULL;
objects = new object[numberofobjects];
// GOOD
vector<object> objects(numberofobjects);
|
As you noticed alreday baout your code; your printObjects function is uncoupled from the Object definition (likewise createObject). This is very C style code. It's bad. If the Object changes, this function needs to be undated as well, even though it isn't a class member. It also relies heavily on being passed an array and a number of objects to print out. This is both binding the hands of users, and is also just dangerous.
Objects should look after themselves. Object should know about its own internals, other functions shouldn't have to care; the Object should contain a member function that will output its values to any given output stream.
#include "object.cpp"
This is a massive misunderstanding of how C++ programs are built. You get away with it in this very simple program, but as soon as you have a program in which more than one source file needs to use your objects, the program will become impossible to build. You are
not meant to #include all the source code into one file. You are meant to compile object.cpp on its own,
separately, and main.cpp on its own,
separately, and then the linker joins them together.
What you are currently writing is C++ only in a literal meaning. You're actually programming "C with Classes". This is a common mistake beginners make, but the longer you go like this - thinking in C and making use of some C++ features - the harder you will find it to actually write good C++.