Fahrzeuge 3: raw pointer
main.cpp File Reference
#include "fahrzeug.h"
#include <algorithm>
#include <iostream>
#include <numeric>
#include <typeinfo>
#include <vector>
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

ostream & operator<< (ostream &s, const Fahrzeug &p)
 Prints some info from a vehicle. More...
 
ostream & operator<< (ostream &s, const vector< Fahrzeug * > &v)
 Prints the whole vector of base class pointers. More...
 
bool fuel_consumption (const Fahrzeug *a, const Fahrzeug *b)
 Compares the fuel consumption between two vehicles. More...
 
float add_fuel (float x, const Fahrzeug *y)
 Adds the fuel consumption of a vehicle y to quantity x. More...
 
int main ()
 

Function Documentation

◆ add_fuel()

float add_fuel ( float  x,
const Fahrzeug y 
)

Adds the fuel consumption of a vehicle y to quantity x.

Parameters
[in]xgiven quantity
[in]ybase class pointer to vehicle
Returns
x+y.fuel

Definition at line 71 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fuel_consumption()

bool fuel_consumption ( const Fahrzeug a,
const Fahrzeug b 
)

Compares the fuel consumption between two vehicles.

Parameters
[in]abase class pointer to first vehicle
[in]bbase class pointer to second vehicle
Returns
true if a needs less fuel than b

Definition at line 57 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( )

Definition at line 76 of file main.cpp.

Here is the call graph for this function:

◆ operator<<() [1/2]

ostream & operator<< ( ostream &  s,
const Fahrzeug p 
)

Prints some info from a vehicle.

Parameters
[in,out]soutput stream
[in]pa general vehicle
Returns
changed output stream

Definition at line 157 of file main.cpp.

Here is the call graph for this function:

◆ operator<<() [2/2]

ostream & operator<< ( ostream &  s,
const vector< Fahrzeug * > &  v 
)

Prints the whole vector of base class pointers.

Parameters
[in,out]soutput stream
[in]vvector of base class pointers
Returns
changed output stream

Definition at line 169 of file main.cpp.