/*
  vv.c: C equivalent of VV subclass:

  implementation class VV;
  void method print() {
      printf( "[%.3f,%.3f,magnitude %g]", x, y, magnitude() );
  }
*/

#include <stdio.h>
#include <stdlib.h>

#include "vector2.h"
#include "vv.h"


static void print( VV this )
{
	printf( "[%.3f,%.3f,magnitude %g]", this->x, this->y, OM0(this,magnitude) );
}

VV alloc_VV( void ) {
	VV v       = alloc_Vector2();       // allocator chaining
	return v;
}

void init_VV( Vector2 v, double x, double y ) {
	init_Vector2( v, x, y );            // initializer chaining
	v->print   = &print;                // now override methods
	v->isa     = "VV";		    // and attributes
}

VV new_VV( double x, double y ) {
	VV v       = alloc_VV();
	init_VV( v, x, y );
	return v;
}
