Can I use methods of a class without instantiating this class?

前端 未结 11 2119
执念已碎
执念已碎 2020-12-15 04:10

I have a class with several methods and there is no constructor among these methods.

So, I am wondering if it is possible to call a method of a class without a creat

11条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-15 05:03

    If the methods are static, yes.

    But you won't be able to access non-static members.

提交回复
热议问题