search

Home  >  Q&A  >  body text

c++ - How to fix this problem

Code:

// 获取面积和周长
double      getArea()
{
    return sqrt((m_posLeftTop.getX - m_posRightBottom.getX)*(m_posLeftTop.getX - m_posRightBottom.getX)*(m_posLeftTop.getY - m_posRightBottom.getY)*(m_posLeftTop.getY - m_posRightBottom.getY));
}
double      getCircumference()
{
    return (fabs(m_posLeftTop.getX - m_posRightBottom.getX) + fabs(m_posLeftTop.getY - m_posRightBottom.getY)) * 2;
}

typechotypecho2750 days ago693

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-06-08 11:03:30

    m_posLeftTop.getX()

    reply
    0
  • 学习ing

    学习ing2017-06-08 11:03:30

    I’m not sure about your code.

    If m_posLeftTop is a pointer, change it to m_posLeftTop->getX
    If getX is a method, change it to m_posLeftTop.getX()
    If it is both of the above, change it to m_posLeftTop->get()

    reply
    0
  • Cancelreply