# How to use abstract Operator Overloading with extern together?

**URL:** <https://community.haxe.org/t/how-to-use-abstract-operator-overloading-with-extern-together/1609>\
**Category:** Haxe\
**Tags:** extern, abstract\
**Created:** [March 17, 2019, 9:10am UTC](https://community.haxe.org/t/how-to-use-abstract-operator-overloading-with-extern-together/1609 "2019-03-17T09:10:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [March 17, 2019, 9:10am UTC](https://community.haxe.org/t/how-to-use-abstract-operator-overloading-with-extern-together/1609/1 "2019-03-17T09:10:50Z")

</div>

there are some condition I want to use abstract and extern together

like this

var v1=new Point(1,1);  
var v2=new Point(0,0);;  
var v3=v2-v1;//here I have confusing how to implement with extern class

extern class Point

{  
@:overload(function (values:Array) : Void{})  
@:overload(function (object:Dynamic) : Void{})  
@:overload(function (size:Size) : Void{})  
@:overload(function (point:Point) : Void{})  
function new(x:Float, y:Float) : Void;  
}

here I know we can write another abstarct class for Operator Overloading,

[Operator Overloading](https://haxe.org/manual/types-abstract-operator-overloading.html)

but how to use

@:overload in abstract class ?

---

<div class="post-metadata">

**Author:** ![nadako](https://community.haxe.org/user_avatar/community.haxe.org/nadako/32/5_2.png) [@nadako](https://community.haxe.org/u/nadako)\
**Post date:** [March 18, 2019, 5:16pm UTC](https://community.haxe.org/t/how-to-use-abstract-operator-overloading-with-extern-together/1609/2 "2019-03-18T17:16:39Z")

</div>

Unfortunately, Haxe doesn’t support operator overloading for _classes_, even for `extern`, so you’ll have to go with an additional `abstract`. Here’s how I do it in hxdefold: [hxdefold/Vector3.hx at master · hxdefold/hxdefold · GitHub](https://github.com/hxdefold/hxdefold/blob/master/src/defold/types/Vector3.hx)
