A
Abhishek Saksena
Does anybody know how I can achieve the following
I have different flavors of base class :-
========================
class base //empty class
{
};
class base //base class with x_type defination
{
public:
typedef int x_type;
}
class base //base class with y_type defination
{
public:
typedef int y_ype;
}
class base //base class with x_type and y_type defination
{
public:
typedef int x_type;
typedef int y_ype;
}
==========================
now I want to use one of these base class as a template parameter to some
other class. Something like
template<typaname T>
class xyz
{
typedef typename T::x_type x_type;
typedef typename T::y_type y_type;
};
The issue is that if the both or one of the types not defined in the base
class then I would like to initialize the x_type and y_type (defined in
class xyz) to some default type like bool.(without generating the
compile-time error)
Abhishek
I have different flavors of base class :-
========================
class base //empty class
{
};
class base //base class with x_type defination
{
public:
typedef int x_type;
}
class base //base class with y_type defination
{
public:
typedef int y_ype;
}
class base //base class with x_type and y_type defination
{
public:
typedef int x_type;
typedef int y_ype;
}
==========================
now I want to use one of these base class as a template parameter to some
other class. Something like
template<typaname T>
class xyz
{
typedef typename T::x_type x_type;
typedef typename T::y_type y_type;
};
The issue is that if the both or one of the types not defined in the base
class then I would like to initialize the x_type and y_type (defined in
class xyz) to some default type like bool.(without generating the
compile-time error)
Abhishek