If i pass a value into the constructor of a sub class...


1
2
3
4
5
6
7
8
9
10
11
Example::Example(int y, std::string z) 
{
age = y;
name = z;
}
{
------Do i still have to create a setMethod like this

void Example::SetExamples(int y, std::string z)
{
age = y;
name = z;
}

}



Sorry for the bad text format =/
Last edited on
The answer is: whatever you need. If you need to modify data after creation, you cam create setter for data. If you don't, you would be better without it.
Topic archived. No new replies allowed.