fork download
  1. using static System.Console;
  2.  
  3. public class Program {
  4. public static void Main() {
  5. var vetor = new Vetor(3, 4);
  6. var vetor2 = vetor * 2f;
  7. WriteLine($"X = {vetor2.X}, Y = {vetor2.Y}");
  8. }
  9. }
  10.  
  11. public struct Vetor {
  12. public float X, Y;
  13. public Vetor(float X, float Y) {
  14. this.X = X;
  15. this.Y = Y;
  16. }
  17. public static Vetor operator *(Vetor left, float right) => new Vetor(left.X * right, left.Y * right);
  18. }
  19.  
  20. //https://pt.stackoverflow.com/q/230538/101
Success #stdin #stdout 0.02s 16456KB
stdin
Standard input is empty
stdout
X = 6, Y = 8