Advertisement
Guest User

jens1

a guest
Nov 20th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "Vector2f.h"
  3. #include <iostream>
  4.  
  5. Vector2f::Vector2f(float aX, float aY) //constructor initializer list
  6. : x{ aX }
  7. , y{ aY }
  8. {
  9. std::cout << "Two argument constructor\n";
  10. //x = aX;
  11. //y = aY;
  12. }
  13. //Vector2f() : x{}, y{} //constructor initializer list
  14. Vector2f::Vector2f() : Vector2f(0, 0)//constructor delegation
  15. {
  16. std::cout << "Default constructor\n";
  17. }
  18. void Vector2f::Print()
  19. {
  20. std::cout << "(" << x << ", " << y << ") \n";
  21. }
  22. float Vector2f::GetLength()
  23. {
  24. return std::sqrt(x * x + y * y);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement