שים לב, בקוד הבא הצהרתי על שיטה זהה בפעולה שלה, אבל הוספתי את המילה static:
using System; class Example { public void myWriteLine(string s) { Console.WriteLine("{0}", s); } public static void myWriteLine2(string s) { Console.WriteLine("{0}", s); } } class Akoka { public static void Main() { Example exm = new Example(); exm.myWriteLine("Hello"); Example.myWriteLine2("Hello"); } }
|
עכשיו, אם תשים לב, אני פונה ישירות לשיטה דרך השם של המחלקה שלה ולא דרך השם שהצהרתי - תלמד OOP לעומק וגם תבין בדיוק למה.
\x6C\x65\x65\x74\x68\x61\x78\x30
\x72\x3A\x2D\x29
tresp4sser