what is this static

hi
i am using
a public class Music written in seperate file for playing sounds
through it's objects..
i am using like this Music.play(Music.p)..where p is object of Music class
i declared player as bellow
Public Player player....in Music class
i want to use 1 method associated with Player..

ex Player.getState()
in another file but
it is giving error like this when i use..
non static member cannot be used..
but if i made player static.. i cant use a single player to play different sounds..
how to overcome it please any one help me

Comments

  • : hi
    : i am using
    : a public class Music written in seperate file for playing sounds
    : through it's objects..
    : i am using like this Music.play(Music.p)..where p is object of Music class
    : i declared player as bellow
    : Public Player player....in Music class
    : i want to use 1 method associated with Player..
    :
    : ex Player.getState()
    : in another file but
    : it is giving error like this when i use..
    : non static member cannot be used..
    : but if i made player static.. i cant use a single player to play different sounds..
    : how to overcome it please any one help me
    :
    :
    It looks like getState is not a static method, so to call it, you must have a Player object.
    [italic][blue]Just my 2 bits[/blue][/italic]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion