class Animal
{
public:
Animal(int weight,int height): //A初始化列表
m_weight(weight),
m_height(height)
{
}
Animal(int weight,int height) //B函数体内初始化
{
m_weight = weight;
m_height = height;
}
private:
int m_weight;
int m_height;
};
类的初始化列表一般是为了性能而做的,这个知识点等掌握了再来更新------------------------------------------------