Returning a double pointer to an object of template class

512 Views Asked by At

I have a template class:

template<class T> 
class CVariable
{
     //lines ommited
};

and another class:

class CLengthUnits:public CUnits
{
     //lines ommited
};

but when i try to return from a function:

CVariable<CLengthUnits>** PointsOfSection(void)
{
     //lines ommited
}

the compiler gives me an error:

error C2143: syntax error : missing ';' before '<'

Anyone an idea?

1

There are 1 best solutions below

6
On
template<class T> 
class CVariable**
{
   //lines ommited
};

The asterisks don't belong there. Remove them.


EDIT: In response to OP's comment, the following program compiles just fine for me:

class CUnits {};

template<class T>
class CVariable
{
     //lines ommited
};

class CLengthUnits:public CUnits
{
     //lines ommited
};

CVariable<CLengthUnits>** PointsOfSection(void)
{
     //lines ommited
}

I think there is something you are still not telling us.