I am not a Flex user, I don't know how to do that yet. But here is my
problem anyways.

I have been working on my final project for school.  I set up all my
classes.  I was having difficulty with getting them to work.  My base
class contains all the data that is necessary to set up the all the
class that follow. For example.

package packageName{

     //the base class
     public class A{

         //the base class method
         public function getBla(bla1, bla2){
             bla1 defined...
             bla2 defined...
         }
}

package packageName{

     //on of the subclass's
     public class B extends A{

         //subclass method
         override public function getBla(bla1, bla2, bla3, bla4 ){
             bla1 and bla2 are inherited automatically
             bla3 and bla4 are defined
     }
}

package{

     import flash.display.Sprite;
     import packageName.*;

         //the main class
         public class mainClassName extends Sprite{

         private var theBla:B;
         public function mainClassName(){
             theBla.getBla();
         }
     }
}

     Anyhow it didn't work.  It seems that overriding does just that and
only that, "overide".  The compiler will not let me add Bla3 and Bla4
without throwing an error.  Also I can't remove the keyword override
because the compiler thinks I am trying to override the Method when all
I am really trying to do is update the method.

     Another problem I am trying to work out is data types.  Not only
does flash expect you to data type your parameters, but it also expects
you to data type the methods.  I am sure that I have some sort of
misunderstanding about this, but here is my flawed interpretation
anyways.

         public function getBla(bla1:String, bla2:String):String{
             bla1 = 'bla bla bla';
             bla2 = 'bla bla bla';
            }
     But what if I want to add a string and a numeric type in the same
method? Then what what datatype do I declare my method to be?

         public function getBla(bla1:String, bla2:int):???{
             bla1 = 'bla bla bla';
             bla2 = 123;
            }
     And if I am actually successful overiding or updating or whatever a
method in a subclass, then how do I data type the subclass or base class
for that matter?

         //base class
         public function getBla(bla1:String, bla2:String):?String?{
             bla1 = 'bla bla bla';
             bla2 = 123;
            }

         //subclass
         public function getBla(bla1:String, bla2:String, bla3:int,
bla4:int):???{
             bla3 = 456;
             bla4 = 123;
            }

Also, if you notice that some of my terminology is off, then please feel
free to correct me.  I am still a learning the basics.

Thanks,
Donovan

Reply via email to