I l@ve RuBoard Previous Section Next Section

Item 42. Variable Initialization桹r is it?

Difficulty: 3

This first problem highlights the importance of understanding what you write. Here we have four simple lines of code, no two of which mean the same thing, even though the syntax varies only slightly.

What is the difference, if any, between the following? (T stands for any class type.)



T t; 


T t();


T t(u);


T t = u;


    I l@ve RuBoard Previous Section Next Section