Anonymous user
Classes: Difference between revisions
→{{header|Go}}
No edit summary |
|||
Line 1,526:
</pre>
=={{header|GLSL}}==
There are no classes in GLSL, but they can be simulated using structs:
<lang>
public class Rectangle{
public double width;
public double height;
public Rectangle(double width, double height){
this.width = width;
this.height = height;
}
public double area(){
return this.width*this.height;
}
public double perimeter(){
return (this.width+this.height)*2.0;
}
}
</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.
|