Anonymous user
Classes: Difference between revisions
→{{header|GLSL}}: oops
(→{{header|GLSL}}: oops) |
|||
Line 1,529:
There are no classes in GLSL, but they can be simulated using structs:
<lang>
};
Rectangle
this.width = width;▼
Rectangle self;
this.height = height;▼
}▼
}
}▼
public double perimeter(){▼
double area(Rectangle self){
return (this.width+this.height)*2.0;▼
return self.width*self.height;
}
}
</lang>
=={{header|Go}}==
The task describes several concepts concerning class methods before giving some task requirements. The following code satisfies the task requirements. The concepts described however, are more involved. A discussion of these concepts follows.
|