Пример #1
0
		} } // BooleanConstructorObj
	
	
	// Implementation for calling the Boolean constructor as a function.
	// "When Boolean is called as a function rather than as a constructor,
	// it performs a type conversion."
	private static object BooleanConstructorFunction(object this_, params object[] args)
		{
		if (args.Length == 0)
			return 0;
		else
			return JConvert.ToBoolean(args[0]);
		
		} // BooleanConstructorFunction
Пример #2
0
		} // BooleanConstructorFunction
	
	
	// Implementation for calling the Boolean constructor as a constructor.
	// "When Boolean is called as part of a new expression, it is a constructor:
	// it initialises the newly created object."
	public static object BooleanConstructor(object this_, params object[] args)
		{
		bool boolValue;
		if (args.Length == 0)
			boolValue = false;
		else
			boolValue = JConvert.ToBoolean(args[0]);
		
		return new JBooleanObject(boolValue);
		} // BooleanConstructor