Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "Vector2f.h"
- #include <iostream>
- Vector2f::Vector2f(float aX, float aY) //constructor initializer list
- : x{ aX }
- , y{ aY }
- {
- std::cout << "Two argument constructor\n";
- //x = aX;
- //y = aY;
- }
- //Vector2f() : x{}, y{} //constructor initializer list
- Vector2f::Vector2f() : Vector2f(0, 0)//constructor delegation
- {
- std::cout << "Default constructor\n";
- }
- void Vector2f::Print()
- {
- std::cout << "(" << x << ", " << y << ") \n";
- }
- float Vector2f::GetLength()
- {
- return std::sqrt(x * x + y * y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement