Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-03-2012, 09:16 AM   #1
bitbitbit
Member
 
Join Date: Aug 2008
Posts: 59
Default Singleton error 1024

Hi,

I'm trying to implement singleton in my project.

This is my code:
Code:
package controller
{
	public class MaterialCheckInController
	{
		private static var instance : MaterialCheckInController;
		
		public  function MaterialCheckInController( enforcer : SingletonEnforcer ) {
		
		}
		
		public static function getInstance() : MaterialCheckInController {
			if (!instance) {
				instance = new MaterialCheckInController( new SingletonEnforcer() );
			}
			return instance;
		}
		
	}

}

class SingletonEnforcer extends AbstractController
{...}
I'm getting the following error:
1024: Overriding a function that is not marked for override. MaterialCheckInController.as /TestApplicatieFlex/src/controller line 1 Flex Problem
bitbitbit is offline   Reply With Quote
Old 04-03-2012, 09:30 AM   #2
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,406
Default

Why is the enforcer extending AbstractController? Makes no sense...
I am guessing that you want MaterialCheckInController to extend it instead...
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.
Barna Biro is offline   Reply With Quote
Old 04-03-2012, 09:31 AM   #3
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

Your enforcer is out of scope so you need to explicitly reference any class there or import them in that scope:
ActionScript Code:
class SingletonEnforcer extends controller.AbstractController
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 04-03-2012, 09:40 AM   #4
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,406
Default

The problem is that the above doesn't make any sense in the first place The enforcer should normally have absolutely nothing to do with the AbstractController... Most likely that thing is just a mistake and MaterialCheckInController was the one originally intended to extend AbstractController.
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.
Barna Biro is offline   Reply With Quote
Old 04-03-2012, 09:51 AM   #5
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

well he put 3 little dots in the enforcer declaration as if he's gonna write code there.
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 04-03-2012, 09:56 AM   #6
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,406
Default

Quote:
Originally Posted by ASWC View Post
well he put 3 little dots in the enforcer declaration as if he's gonna write code there.
He shouldn't... That's what I am trying to explain...
Even so, the "extend AbstractController" part is completely out of place.

Or maybe someone can explain why would it make sense for a helper class that is supposed to enforce a single instance for the object in matter extend a type that based on it's name at least is more appropriate to be the superclass of the class that we are trying to limit to a single instance. I am not saying that such enforcers should always be empty ( although 99% of the time they are ), but in the above case, things simply make no sense to me.

So why not stop a bad design now than let it possibly cause havoc later on?
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.

Last edited by Barna Biro; 04-03-2012 at 10:12 AM.
Barna Biro is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:36 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.