Explain the differences between list x; & list x();.



Explain the differences between list x; & list x();...

Answer / Rajkumar Sharma

The declarations 'list x;' and 'list x();' both create a new std::list object named 'x', but they differ in how the object is initialized.n
1. list x;: This declaration creates an empty list without performing any initializations.
2. list x();: This declaration creates an empty list using the default constructor, which means that it invokes all the implicitly generated constructors for the specified type and sets up the necessary resources (e.g., memory allocations).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

How do you master coding?

1 Answers  


how to create window program in c++.please explain.

1 Answers   Microsoft,


Name four predefined macros.

1 Answers  


Explain how functions are classified in C++ ?

1 Answers  


What are access specifiers in C++?

3 Answers  


What is the difference between reference type and pointers.

4 Answers   HCL,


Give an example of run-time polymorphism/virtual functions.

1 Answers  


What is the difference between = and == in C?

20 Answers   Christ University, Intel,


What are pointer-to-members? Explain.

1 Answers   iNautix,


What is the difference between ++ count and count ++?

1 Answers  


What is #include iomanip?

1 Answers  


In c++, what is the difference between method overloading and method overriding?

1 Answers  


Categories