Access vialotion

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 22 05:45:29 PDT 2016


I have an array of buttons:

class Window : MainWindow{
     private Button[4] bArr;
     this(){
         Button btn_1 = new Button();
         Button btn_2 = new Button();
         Button btn_3 = new Button();
         Button btn_4 = new Button();
         Button[4] bArr = [btn_1,btn_2,btn_3,btn_4];
     }
     private void letButtonsFlash(){
         for(int i = 0; i < 4; i++){
             writeln(this.bArr[i].getName());
         }
     }
}

i don't understand why i get an 'Access Violation' - Error in the 
'for'-loop?


More information about the Digitalmars-d-learn mailing list