Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -2,12 +2,6 @@ class vector {
|
|||
private:
|
||||
double x, y
|
||||
public:
|
||||
class literal {
|
||||
double v
|
||||
class:
|
||||
module Literal(.v) {
|
||||
}
|
||||
}
|
||||
operator "+" (b as vector){
|
||||
.x+=b.x
|
||||
.y+=b.y
|
||||
|
|
@ -16,13 +10,19 @@ public:
|
|||
.x-=b.x
|
||||
.y-=b.y
|
||||
}
|
||||
operator "*" (b as literal){
|
||||
.x*=b.v
|
||||
.y*=b.v
|
||||
function mul_literal(b as double){
|
||||
ret=this
|
||||
' x in ret is private but is accessible...
|
||||
' ...from same type's member of other object.
|
||||
ret.x=.x*b
|
||||
ret.y=.y*b
|
||||
=ret
|
||||
}
|
||||
operator "/" (b as literal){
|
||||
.x/=b.v
|
||||
.y/=b.v
|
||||
function div_literal(b as double){
|
||||
ret=this
|
||||
ret.x=.x/b
|
||||
ret.y=.y/b
|
||||
=ret
|
||||
}
|
||||
property printVector {
|
||||
value {
|
||||
|
|
@ -57,10 +57,10 @@ s$="Sum of vectors a and b : "+sum_a_b.printVector+{
|
|||
diff_a_b=a-b
|
||||
s$="Difference of vectors a and b : "+diff_a_b.printVector+{
|
||||
}
|
||||
mul_a_3=a*a.literal(3)
|
||||
mul_a_3=a.mul_literal(3)
|
||||
s$="Multiplying vector a by 3 : "+mul_a_3.printVector+{
|
||||
}
|
||||
div_b_2.5=b/b.literal(2.5)
|
||||
div_b_2.5=b.div_literal(2.5)
|
||||
s$="Dividing vector b by 2.5 : "+div_b_2.5.printVector+{
|
||||
}
|
||||
report s$
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue