Possible duplicate:
Why is there no constructor call?
I am using Visual studio 2012, suppose Test is a class
class Test { };
When I create a new instance of Test, what's the difference between the two methods?
method 1
Test t;
way 2
Test t();
I got this question in the code below, initially, I defined an instance of A in path 2, I have only one error, because B does not provide a default constructor, but when I define it in order 1, I got an additional error.
class B { B(int i){} }; class A { A(){} B b; }; int main(void) { A a();
if I define a so that 1
A a;
I get another error:
error C2248: "A :: A": cannot access the private member declared in class 'A'
Therefore, I suggest that there should be some differences between the two methods.
zdd
source share