How to call one static method from another?
Konstantin Kutsevalov via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 14 01:03:20 PDT 2016
On Tuesday, 14 June 2016 at 07:35:36 UTC, Andrea Fontana wrote:
> On Tuesday, 14 June 2016 at 07:20:47 UTC, Konstantin Kutsevalov
> wrote:
>> May be my question was not enought clean...
>> this is example of code:
>>
>> ```
>> class ClassName {
>>
>> public static void function method1()
>> {
>> // do something
>> // and now I need to call other static method
>> ClassName.method2(); // What I can use insted of full
>> class name?
>> // Like "self.method2()"
>> }
>>
>> public static void function method2()
>> {
>> //...
>> }
>> }
>> ```
>
> Simply:
> method2();
>
> Anyway I guess you mean public static void method1() { }
> without "function"
>
> Andrea
Yep, it's my mistake about "function" :)
Thanks!
More information about the Digitalmars-d-learn
mailing list