I've got a Network class, that we want two virtual functions which I will overload: airtime() and airtime(std::vector<int> freq_bins)

I define the course, and also the functions at the end:

class Network
{
  public:

    // Properties of the network protocol
    std::string _name;
    std::vector<float> _channels;
    float _bandwidth;
    float _txtime;

    // Properties of the specific network
    int _id;
    macs::mac_t _mac;
    protocols::protocol_t _protocol;
    bool _static;
    float _desired_airtime;
    float _act_airtime;
    bool _active;

    // Constructor
    Network();
    virtual float airtime() { };
    virtual float airtime(std::vector<int> freq_bins) { };
};

Now, I've got a second class which I wish to overload them. This is actually the header of the class:

#ifndef _CSMA_H_ 
#define _CSMA_H_ 

#include <string> 
#include <vector> 
#include <map> 
#include "MACs.h" 
#include "Protocols.h" 
#include "Network.h" 

class CSMA : public Network  
{ 
  public: 

    float center_freq; 

    CSMA(); 
    float airtime(); 
    float airtime(std::vector<int> freq_bins); 
}; 

#endif 

Then i define them in CSMA.cpp:

#include <iostream>
#include <string>
#include <vector>
#include "MACs.h"
#include "Protocols.h"
#include "Network.h"
#include "Simulator.h"
#include "CSMA.h"

extern Simulator sim;

CSMA::CSMA() {
  _mac = macs::CSMA;
}

float CSMA::airtime() {
  return _act_airtime;
}

float CSMA::airtime(std::vector<int> freq_bins) {
  return 1;
}

I recieve the warning on coming back values, that's no problem. However the errors I recieve when attempting to compile this, I do not understand:

g++ -o hce_sim hce_sim.cpp Network.cpp CSMA.cpp -Wall
In file included from hce_sim.cpp:2:
Network.h:54: error: ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’ cannot be overloaded
Network.h:49: error: with ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’
Network.h: In member function ‘virtual float Network::airtime()’:
Network.h:53: warning: no return statement in function returning non-void
Network.h: In member function ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’:
Network.h:54: warning: no return statement in function returning non-void
In file included from Network.cpp:6:
Network.h:54: error: ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’ cannot be overloaded
Network.h:49: error: with ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’
Network.h: In member function ‘virtual float Network::airtime()’:
Network.h:53: warning: no return statement in function returning non-void
Network.h: In member function ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’:
Network.h:54: warning: no return statement in function returning non-void
In file included from CSMA.cpp:6:
Network.h:54: error: ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’ cannot be overloaded
Network.h:49: error: with ‘virtual float Network::airtime(std::vector<int, std::allocator<int> >)’

I produced a far more simplified program to realise why I recieve this error, yet this simplified program works:

#include <iostream>
#include <vector>

class Base {

  public:
    Base() { }
    virtual void check() { }
    virtual void check(bool it) { }
};

class First : public Base {
  public:

    First() { }
    void check() {
      std::cout << "You are in check(void) !\n";
    }

    void check(bool it) {
      std::cout << "You are in check(bool) !\n";
    }
};

int main() {

  First f;
  f.check();
  f.check(true);
}

Does anybody have insight here?

Try pure virtual function terms.

virtual float airtime() = 0;
virtual float airtime(std::vector<int> freq_bins) = 0;

The main reason it fails is you definitions are incorrect, they do not return anything despite the fact that you've specified it should return float.

Tip: You actually should not expose the interior condition of the class like this. Perform some searching on encapsulation.