Class constructor (c++ newb)
Looking at the tutorial on classes, at the constructor part:
Following part in public class:
Quote:
Computer();
//Constructor
Member function:
Quote:
Computer::Computer()
{ //Constructors can accept arguments, but this one does not
processorspeed = 0;
//Initializes it to zero
}
My problem lies that, say I have 5 variables in the private section of the class. I need to initialize those values to 0 if there isn't already anything in there, but do I have to make 6 different member functions, accomodating the fact that they can either send in no variable, one, two, three, etc, or is there a way to make one and have it determine if anything has already been initialized.... I don't know if this makes much sense reading it, but help is appreciated.