Sam Finch
May 3rd, 2000, 08:27 AM
I want a class that I can use inside another class, but I want it to be a combination of 2 different classes. both would have the same functions but somewhere in the constructor I'd like to specify which one the class is using.
say my 2 classes are
class A
{
public:
A(void);
long Fn(void);
};
A::A(void)
{
}
long A::Fn(void)
{
return 10;
}
class B
{
long m_value;
public:
B(long Value);
long Fn(void);
};
B::B(long Value)
{
m_value = Value;
}
long B::Fn(void)
{
return m_value;
}
Now say I want a class C with an overloaded contructor, if I don't include a value in the constructor it inherits a class A, if I do it inherits a class B.
Is that possible?
say my 2 classes are
class A
{
public:
A(void);
long Fn(void);
};
A::A(void)
{
}
long A::Fn(void)
{
return 10;
}
class B
{
long m_value;
public:
B(long Value);
long Fn(void);
};
B::B(long Value)
{
m_value = Value;
}
long B::Fn(void)
{
return m_value;
}
Now say I want a class C with an overloaded contructor, if I don't include a value in the constructor it inherits a class A, if I do it inherits a class B.
Is that possible?