--- In [email protected], Gleb Orlov <lindows_...@...> wrote:
>
> Hello, Olufowobi.
>
> Your code:
>
> >I need to achieve class constant for integral type
> >________________________________
> >
> >class Ball{
> >static const int radius = 10;
> >};
> >
> >I have tried,
> >class Ball
> >{
> >const static double radius ;
> >
> >};
> >Ball::radius = 10.0;
> >
> >________________________________
>
> Answer:
> //==============================================================================
> #include <iostream.h>
> #pragma argsused //pragma of Borland C++ Builder 5.
> //==============================================================================
> class Ball
> {
> const double radius;
> const static double circle;
> public:
> Ball():radius(12.3){} //Initialise value 'radius' in construtor
--------------------
------------------
>
> Gleb mailto:lindows_...@...
Hello All,
namespace para{
const double DIA = 18;
class Parameters
{
public:
Parameters();
}
}
I ended up doing this. so I can have para::DIA
Thanks,I may switch to the last suggestion.
But I really don't get why (instantiating class variable const) only works for
integral types (bool,int, char) and not other types.
Olufowobi Lawal.