Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static property and method #252

Open
arshidkv12 opened this issue Jul 16, 2023 · 2 comments
Open

Static property and method #252

arshidkv12 opened this issue Jul 16, 2023 · 2 comments

Comments

@arshidkv12
Copy link

How to add static property and method?

    pub fn hello( q: String) -> String {
        format!("hello {}", q)
    }
@joehoyle
Copy link
Collaborator

@arshidkv12 I believe just that should work for static methods. From the docs:

Class methods can take a &self or &mut self parameter. They cannot take a
consuming self parameter. Static methods can omit this self parameter.

@arshidkv12
Copy link
Author

I want code as follows.

PHP

class my class{

  static $a = 1;
  public static function hello(){

  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants