If I have a user defined default constructor in my Test class, and what operations will done by using the following statement:
Test *test = new Test; //there is no () after new Test
First, does the user default constructor means "constructor without Parameters"? for example:
class Test {
public:
Test() {
// do something here
}
}
so the new Test; means the complier will call the Test() constructor in class Test(); and perform the operations inside it, and allocate memory in heap for class Test object?
And what about the *test"? where is it ? in heap or stack? can anyone explain me? And what about
Test test = new Test();//with () this time
what kind of constructor will be called in this case?