C++ Project 2016-2017: Arkanoid
Public Member Functions | Public Attributes | Friends | List of all members
arkanoid::Vector2D Class Reference

Representation of a vector. More...

#include <vector2D.h>

Public Member Functions

 Vector2D ()
 
 Vector2D (double newX, double newY)
 
Vector2D operator+ (const Vector2D &other) const
 
void operator= (const Vector2D &other)
 
void operator+= (const Vector2D &other)
 
Vector2D operator* (double factor) const
 
void operator*= (double factor)
 

Public Attributes

double x
 The 'x' component of the Vector2D.
 
double y
 The 'y' component of the Vector2D.
 

Friends

ostream & operator<< (ostream &stream, Vector2D &vector)
 

Detailed Description

Representation of a vector.

Definition at line 14 of file vector2D.h.

Constructor & Destructor Documentation

◆ Vector2D() [1/2]

arkanoid::Vector2D::Vector2D ( )

Default Constructor.

Definition at line 11 of file vector2D.cpp.

◆ Vector2D() [2/2]

arkanoid::Vector2D::Vector2D ( double  newX,
double  newY 
)

Constructor.

Parameters
newXThe 'x' component of the new constructed Vector2D.
newYThe 'y' component of the new constructed Vector2D.

Definition at line 13 of file vector2D.cpp.

Member Function Documentation

◆ operator*()

Vector2D arkanoid::Vector2D::operator* ( double  factor) const

'*' Overloader.

Multiply the Vector2D by a factor.

Parameters
factorThe factor.
Returns
The result of the operation.

Definition at line 29 of file vector2D.cpp.

◆ operator*=()

void arkanoid::Vector2D::operator*= ( double  factor)

'*=' Overloader.

Multiply the Vector2D by a factor and asign it to this Vector2D.

Parameters
factorThe factor.

Definition at line 33 of file vector2D.cpp.

◆ operator+()

Vector2D arkanoid::Vector2D::operator+ ( const Vector2D other) const

'+' Overloader.

Adds a Vector2D to the current Vector2D.

Parameters
otherThe other Vector2D that will be added to this Vector2D.
Returns
The result of the operation.

Definition at line 15 of file vector2D.cpp.

◆ operator+=()

void arkanoid::Vector2D::operator+= ( const Vector2D other)

'+=' Overloader.

Adds a Vector2D to the current Vector2D and asign it to this Vector2D.

Parameters
otherThe other Vector2D that will be added to this Vector2D.

Definition at line 24 of file vector2D.cpp.

◆ operator=()

void arkanoid::Vector2D::operator= ( const Vector2D other)

'=' Overloader.

Asign new values to this Vector2D.

Parameters
otherThe Vector2D that contains the new values 'x' and 'y'.

Definition at line 19 of file vector2D.cpp.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  stream,
Vector2D vector 
)
friend

'<<' Overloader.

Prints the values of this Vector2D (debugging reasons).

Parameters
streamThe stream where the outputs is in.
vectorThe vector of which the output is printed.

Definition at line 38 of file vector2D.cpp.


The documentation for this class was generated from the following files: