Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道我可以创建一个类,然后我的所有变量都将受到保护。然后我可以在这个类中插入函数。但是要使用这些函数,我必须创建我的类的一个对象。我不想。我只想使用这些函数,它们必须是变量保护的,并且是可导入的。
如果你不想实例化(“创建一个对象”)一个类来使用它的函数,你可以创建你的函数static。
static
public class MyClass { public static function myFunction(){ trace("yada!"); } } // You call it this way MyClass.myFunction();
“受保护的变量”和“可导入的”是什么意思?