Hi all,
I am trying to compile following code :-
=======================================
#include <iostream.h>
#include <string>
namespace tlm
{
template <typename REQUEST, typename RESPONSE >
class tlm_transport_if
{
public:
// Virtual function: for implementation of transport layer
virtual RESPONSE transport (const REQUEST &) = 0;
}; // end of class tlm_transport_if
}
class master_out_if
{
private:
class inherit: public tlm::tlm_transport_if<int,bool >,
public tlm::tlm_transport_if<char,bool >,
public tlm::tlm_transport_if<double,bool >
{};
public:
typedef inherit type;
};
class x:public master_out_if::type
{
public:
bool transport (const int&){}
bool transport (const char &){}
bool transport (const double &){}
};
int main()//this can be bus model
{
bool var;
master_out_if::type *var1=new x;
var1->transport((int)(100));
}
==========================================
The problem is that I get a compile time error which says
-----------------------------------------------------------
test2.cpp: In function `int main()':
test2.cpp:55: cannot allocate an object of type `x'
test2.cpp:55: because the following virtual functions are abstract:
test2.cpp:13: RESPONSE tlm::tlm_transport_if<REQUEST,
RESPONSE>::transport(const REQUEST&) [with REQUEST = double, RESPONSE =
bool]
test2.cpp:56: request for member `transport' is ambiguous
test2.cpp:13: candidates are: RESPONSE tlm::tlm_transport_if<REQUEST,
RESPONSE>::transport(const REQUEST&) [with REQUEST = double, RESPONSE =
bool]
test2.cpp:13: RESPONSE tlm::tlm_transport_if<REQUEST,
RESPONSE>::transport(const REQUEST&) [with REQUEST = char, RESPONSE =
bool]
test2.cpp:13: RESPONSE tlm::tlm_transport_if<REQUEST,
RESPONSE>::transport(const REQUEST&) [with REQUEST = int, RESPONSE =
bool]
--------------------------------------------------------------------
Does that mean overloading of virtual functions is not allowed?. If not how
I can implement this functionality
Abhishek