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

Sep 15, 2014 at 5:24am

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 Sep 15, 2014 at 5:25am
Sep 15, 2014 at 6:03am
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.