What is the new operator during object creation

Hello!

Some c++ syntax that I have to do for a course, seems to not exactly be in the code academy. I’m trying to understand the new operator, when it’s used, and how it relates to object initialization. It seems like this is very common in real developed software, so I’d really appreciate a hand!

For example for object rectangle creation of class Polygon to say… calculate the area:

int main() {
...
	Polygon* rectangle = new Rectangle(5, 6);
        ...
        	rectangle->setHeight(10);
	        rectangle->setWidth(10);
       ...
}

According to: Microsoft cpp docs

the new operator attempts to allocate and initialize an object or array of objects of a specified or placeholder type, and returns a suitably typed, nonzero pointer to the object

  1. I understand the pointer involved is used to allocate memory, but why do this as opposed to standard object initialization?
  2. Related to this, is a question on the member access operator shown above “->”. What would be the limits to using this, and it’s relationship to inheritance, public, private, and protected methods?

Thanks for any help!