A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] override protected getter?

Threaded View

  1. #1
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429

    resolved [RESOLVED] override protected getter?

    I have 3 classes set up. An abstract, a concrete and a utility that needs access to the concretes getter. When I try to access the property of the concrete from within the utility it throws an error.

    //abstract
    PHP Code:
    package{
      
    import flash.errors.IllegalOperationError;
      class{
        protected function 
    get left():Number{
          throw new 
    IllegalOperationError("Abstract method: must be overridden in a subclass");
        }
      }

    //concrete
    PHP Code:
    package{
      class extends abstract{
        
    override protected function get left():Number{
          return 
    someVal;
        }
      }

    //utility
    PHP Code:
    package{
      class 
    utility{
        private var 
    concrete:abstract;
        public function 
    utility(concreteClass:abstract){
          
    this.concrete concreteClass;
          
    init();
        }
        private class 
    init():void{
          
    trace(concrete.left); //1178: Attempted access of inaccessible property left through a reference with static type abstract.
        
    }
      }

    //client
    PHP Code:
    package{
      class{
        public function 
    client():void{
          var 
    = new concrete();
          var 
    = new utility(c);
        }
      }

    Any idea how to gain access?
    Last edited by jAQUAN; 12-07-2008 at 04:49 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center