Oct 9, 2011 at 1:12pm
Hi cplusplus forum,
I am trying to translate the following java to c++, I'm still a bit new to C++ so I don't understand all the syntax yet.
1 2 3 4 5
|
interface A<K, V>
{
K getKey();
V getValue();
}
|
1 2 3
|
class B implements A<int, B>
{
}
|
and I'm having some trouble getting the header of class B right.
A.h:
1 2 3 4 5 6
|
template<class K, class V>
class A
{
K getKey();
V getValue();
};
|
B.h
1 2 3 4 5 6 7
|
include "A.h"
class B; //forward declaration
class B : A<int, B>
{
int getKey();
B getValue();
};
|
Thank you
Last edited on Oct 9, 2011 at 3:21pm
Oct 9, 2011 at 3:25pm
Thank you, that was it. I've added the code tags in the original post too.