c++ const key word

hi I'm new to c++ .
can anybody explain me the following code line

code:
class xx2: public xx {
public:
x* create x(x& con) const {
return new x(con);
}
my question are following :
what is the const keyword doing here ?
what is the meaning of const (constant here)?
In return statement what is new doing ?
can we return new in a function ?
Is it a example of dynamic constructor

Please explain me both the concept
what is the const keyword doing here ?
what is the meaning of const (constant here)?

It makes the function a constant member function. That means it cannot modify any members, but in turn, it can be called for a constant object.

In return statement what is new doing ?
can we return new in a function ?

It's doing the same as it would in any other context.
new constructs an object of the specified type and returns a pointer to it.

Thanx for explaining the concept
Topic archived. No new replies allowed.