classes
what is the purpose of getter function in classes and how to write constructor in classes.
For encapsulation purposes.
Constructor for classes is the name of the class '::' then again name of the class. Example:
1 2 3
|
Car::Car() {
//do something
}
|
You can also add parameters:
1 2 3
|
Car::Car(int i) {
//do something
}
|
Topic archived. No new replies allowed.