Is a default constructor a constructor that never takes a value, or is there a difference between a constructor that accepts no parameters and a default constructor? If you create a constructor that takes no parameters, does this automatically become your default constructor?
For instance, is this constructor a default constructor? Why or why not?
Code:
template <class T>
class ListNode
{
public:
ListNode();
// ...
private:
ListNode* nextPtr;
T* data;
};
template <class T>
ListNode<T>::ListNode():
nextPtr(0), data(0)
{}
One last question, if you provide default paramaters to a no-argument constructor, is it still a default constructor?
Code:
const int DEFAULT_ARRAY_SIZE = 10;
class Array
{
public:
Array(arraySize = DEFAULT_ARRAY_SIZE);
// ...
private:
// ...
int arraySize;
};