Revert "Merge pull request #853 from ivannp/underscores"
This reverts commita964098754, reversing changes made tobda3a11f9e. SWIG should only provide default operator names that provide special standard or conventional meaning in the target language.
This commit is contained in:
parent
3dfb2298a8
commit
f9158e525f
4 changed files with 38 additions and 68 deletions
|
|
@ -19,37 +19,10 @@ double Circle::perimeter() {
|
|||
return 2*M_PI*radius;
|
||||
}
|
||||
|
||||
Circle::Circle(double xx, double yy, double rr)
|
||||
: radius(rr)
|
||||
{
|
||||
x = xx;
|
||||
y = yy;
|
||||
}
|
||||
|
||||
bool Circle::operator==(const Circle & other)
|
||||
{
|
||||
return x == other.x && y == other.y && radius == other.radius;
|
||||
}
|
||||
|
||||
bool Circle::operator!=(const Circle & other)
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
double Square::area() {
|
||||
return width*width;
|
||||
}
|
||||
|
||||
bool Square::operator==(const Square & other)
|
||||
{
|
||||
return x == other.x && y == other.y && width == other.width;
|
||||
}
|
||||
|
||||
bool Square::operator!=(const Square & other)
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
double Square::perimeter() {
|
||||
return 4*width;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,8 @@ private:
|
|||
double radius;
|
||||
public:
|
||||
Circle(double r) : radius(r) { }
|
||||
Circle(double xx, double yy, double rr);
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
|
||||
bool operator==(const Circle & other);
|
||||
bool operator!=(const Circle & other);
|
||||
};
|
||||
|
||||
class Square : public Shape {
|
||||
|
|
@ -35,7 +31,4 @@ public:
|
|||
Square(double w) : width(w) { }
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
|
||||
bool operator==(const Square & other);
|
||||
bool operator!=(const Square & other);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,14 +31,6 @@ print("Here is their current position:")
|
|||
sprintf(" Circle = (%f, %f)", circle$x,circle$y)
|
||||
sprintf(" Square = (%f, %f)", square$x,square$y)
|
||||
|
||||
c2 <- Circle(1, 5, 15)
|
||||
c1 <- circle
|
||||
c1$move(1, 5)
|
||||
print(Circle_MemberEq(c1, c2))
|
||||
print(Circle_MemberNotEq(c1, c2))
|
||||
|
||||
print(c1$MemberEq(c2))
|
||||
|
||||
# ----- Call some methods -----
|
||||
|
||||
print ("Here are some properties of the shapes:")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue