https://www.cnblogs.com/opencascade/p/3661060.html
TopoDS_Shape theSphereShape = BRepPrimAPI_MakeSphere(1.0);
class BRepPrimAPI_MakeOneAxis : public BRepBuilderAPI_MakeShape {
Standard_EXPORT operator TopoDS_Solid();//重新定义操作符(),则在构造函数中的()符号
使用后则直接返回TopoDS_Solid,直接形成了构造函数直接返回自己想要的值。
}
以下为在类中和类外定义操作符的说明:
https://blog.csdn.net/liitdar/article/details/80654324
实现一个操作符重载的方式通常分为两种情况:
- 将操作符重载实现为类的成员函数;
-
-
bool operator==(const person& ps)
-
{
-
if (this->age == ps.age)
-
{
-
return true;
-
}
-
return false;
-
}
-
- 操作符重载实现为非类的成员函数(即全局函数)。
-
// 左操作数的类型必须被显式指定
// 此处指定的类型为person类
bool operator==(person const& p1 ,person const& p2)
{
if (p1.age == p2.age)
{
return true;
}
else
{
return false;
}
}