The only way to create an object without calling a constructor for it would be to allocate an array of memory large enough and then point a pointer to the object at the array, however that is extremely in advisable.
-
char *buffer = reinterpret_cast<char *>(malloc(sizeof A));
-
A* pa = reinterpret_cast<A *>(buffer);
-
Even this, due to object alignment may not work without further fiddling to ensure the object alignment was correct.
This syntax
is not valid and even if it were valid it would call the default constructor of A first. The closest you could get to this syntax is
-
class A
-
{
-
public:
-
A& getdata(int, int)
-
{
-
return *this;
-
}
-
-
};
-
-
int main()
-
{
-
A a = A().getdata(0, 1);
-
-
return 0;
-
}
-
which calls both the default and copy constructors of A