MyCustomObject * object=new MyCustomObject();
Assume the object pointer is used by many of my classes, but all of a sudden I want to change the con
I think you are having difficulty with the concepts of pointer vs object.
An object is an instance of some type. Be it a base type like an int or a user defined type like a struct or class.
Using new operator, you create a new instance of this type inside of the process's memory called the heap, which is like a room with a pile of clothes in it. So if you create a new instance of a t-shirt, it is like you went out and bought a t-shirt and threw it into that pile. You know that you have an instance of a t-shirt in there somewhere, but you don't really know where.
A pointer points to an object (usually). Think of it like a piece of string that is attached to your t-shirt on one end and you have the other. This allows you to pull out your t-shirt and do stuff with it. Multiple pieces of string can be attached to that t-shirt with different people holding on to each piece, allowing each person to pull it out and use it. Remember, there is only one t-shirt, just multiple pointers to it.
Copying a pointer is like having a new piece of string attaching itself to the object. You do this by assigning one pointer to another tshirt* x = new tshirt(); tshirt* y = x;
A pointer though is a bit dangerous, because it can actually not point to anything. Usually when a programmer wants to recognise that a pointer is not valid, they assign it to NULL, which is a value of 0. In C++11, nullptr should be used instead of NULL for type safety reasons.
Further, if you use the delete operator on a pointer, you are deleting the object it is pointing at. The pointer you just deleted through and any copy of that pointer is then said to be dangling, which means that it is pointing at a memory location that doesn't actually contain a valid object. As a programmer, you must set the value of these pointers to NULL/nullptr or you will have difficult to track down bugs in your code.
The dangling pointer problem can be mitigated using smart pointers like std::unique_ptr and others (if you go through that link, hover over "Dynamic memory management" to get info on more pointer wrappers). These wrappers try and stop you inadvertently creating dangling pointers and memory leaks.
A memory leak is when you create an object using the new operator and then lose the pointer to it. Going back to the pile of clothes analogy, it would be like you dropped your piece of string and thus forgot that you have t-shirt in there, so you go out and buy another one. If you keep doing this, you will find that your pile of clothes may fill the room and eventually cause the room to explode as you have no more room for more t-shirts.
So to get back to your question, to change the contents of an object that you created using the new operator, you can dereference that pointer using the indirection operator (*) or you can call a member function or get/set a member value of the object using the structure dereference operator (->). You are correct that the object = new MyCustomObject() will give you a new pointer address because it has created a new object. If you just want to new pointer that points at the same object, you would do something like this:
MyCustomObject* pObject1 = new MyCustomObject();
// ... do some stuff ...
pObject1->doStuff();
(*pObject1).doMoreStuff();
pObject1->value = 3;
(*pObject1).value = 4;
// ... do some stuff ...
// This copies the pointer, which points at original object instance
MyCustomObject* pObject2 = pObject1;
// Anything done to object pointed at by pObject2 will be seen via going
// through pointer pObject1.
pObject2->value = 2;
assert(pObject1->value == 2); // asserting that pObject1->value == pObject2->value
Note that I prefixed the variable name with p, I (and others) use this to allow me at a glance to determine if the variable is an object or a pointer to an object.
Objects can be created directly on the function call stack without the new keyword.
MyCustomObject object1; // Note: no empty parenthesis ().
MyCustomObject object2(1); // Only use parenthesis if you actually are passing parameters.
These objects are automatically destroyed when the function call ends (or in some cases sooner).
I'm thinking that this is not really what you wanted, but I have just added it for completeness.
There have been references to placement new, which reuses memory that has already been allocated. This is a valid but quite an advanced feature. You have to be careful to call the destructor through the pointer (i.e. pObject1->~MyCustomObject()) prior to doing the in place new (i.e. pObject1 = new (pObject1) MyCustomObject()) otherwise you can have a resource leak (files or may be left open or other resources may be not cleaned up).
Good luck.