Hello, I am currently trying to learn classes in C++. I came across this piece of code today, but I am confused about its syntax. If you look at line 10, it says :asize(size) . What does this exactly mean? I don't think this is the right C++ classes syntax. Please help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class Student
{
public:
Student(int size);
~Student();
private:
int asize;
int *array;
};
Student::Student(int size):asize(size)
{
array = newint[size];
}
Student::~Student()
{
delete [] array;
cout << "free\n";
}