coinjo said:
The constructor takes a constant static data member of its own class
and stores it in one of its non constant and non static data member...
The problem that i am facing here that i am already using a constructor
that takes two int values... Now this constructor takes one int and one
constant static public data member of its own class... How to
differentiate it with the other? And can you please tell me the syntax
with an example...???
Well, if the data member in question is a non-int, it's simple:
struct A
{
A( int, int );
A( int, float );
static const float someConst_;
// ...
};
const float A::someConst_ = 3.14159;
// ...
void Foo()
{
A a1( 1, 2 ); // Calls first constructor
A a2( 1, A::someConst_ ); // Calls second constructor
// ...
}
That's just the usual function overloading.
If someConst_ were an int instead of a float, you'd need to play some
sort of trick (e.g., supplying a dummy parameter to the constructor,
wrapping the constant in a dummy type, etc.). Do you need help with
that?
Cheers! --M