--- In c-prog@yahoogroups.com, Tyler Littlefield <ty...@...> wrote:
>
> 
>               Thanks,
> Tyler Littlefield
>       http://tds-solutions.net
>       Twitter: sorressean
> 
> On Feb 27, 2010, at 4:57 PM, Olufowobi Lawal wrote:
> > >I need to achieve class constant for integral type

I need to achieve class constant for non_integral type

> > Awesome. And? What is the problem? Why can't you just use const? We need 
> > more than one sentence telling us part of what you want.
> > ________________________________
> > 
> > class Ball{
> > static const int radius = 10;
> > };
> > 
> > I have tried,
> > class Ball
> > {
> > const static double radius ;
> > 
> > };
> > Ball::radius = 10.0;
> > 
> > ________________________________
> > 
> > I get an "unresolved external symbol" linker error.
> > 
> > Any other way, this can be achieved?
> > Thanks,
> > Olufowobi Lawal
> > 
> > [Non-text portions of this message have been removed]
> > 
> >

As for why I need it 


In java , I could easily do

public interface Constants {
        
    public static final float BRICKWIDTH  = 20.0;  
    public static final float XLENGTH =20.0;
    public static final float GAMEWIDTH   = BRICKWIDTH * XLENGTH; 
    
    
}


and then


public class GameBoard implements GameConstants {

//

}
I need to do this in c++, but non-integral type can't be initialized within a 
class.

Any way around this?

Thanks
Olufowobi Lawal.


Reply via email to