﻿Function.prototype.inheritsFrom = function(parentClassOrObject) {
    if (parentClassOrObject.constructor == Function) {
        //Normal Inheritance 
        this.prototype = new parentClassOrObject;
        this.prototype.constructor = this;
        this.prototype.parent = parentClassOrObject.prototype;
    }
    else {
        //Pure Virtual Inheritance 
        this.prototype = parentClassOrObject;
        this.prototype.constructor = this;
        this.prototype.parent = parentClassOrObject;
    }
    return this;
}

GLatLng.prototype.toString = function() {
    return this.lat() + ", " + this.lng();
}

GLatLng.prototype.addLat = function(lat) {
    return new GLatLng(this.lat() + lat, this.lng());
}

GLatLng.prototype.addLng = function(lng) {
    return new GLatLng(this.lat(), this.lng() + lng);
}

GLatLng.prototype.transform = function(lat, lng) {
    return new GLatLng(this.lat() + lat, this.lng()+lng);
}
