My initial thoughts on the default constructor are that it was called automatically. From what I can see, it seems that this is so but a constructor called automatically doesn't initialize int or char variables for exampe, to Zero as I originally thought. It appears that they initialize the variable with a garbage value or something associated with the memory location.
**Is it true that the default constructor (if you don't provide a constructor yourself) is called automatically though does not initialize the class variables to any meaningful value? ** I initially thought that it would initialize class variables to zero but it seems that I am wrong on that. It could be a floor in my inderstanding. My code below provides three garbage values for the output if I don't initialize them.
#include <iostream>
#include <cstdlib>
using namespace std;
class test
{
public:
char a,b,c;
char testfunct(char d, char e, char f)
{
a = d;
b = e;
c = f;
}
};
int main()
{
test classtest;
cout << classtest.a << "\n";
cout << classtest.b << "\n";
cout << classtest.c << "\n";
system("pause>nul");
}