/* 
 * Copyright (C) 2020,  Paul Sheer. All rights reserved.
 * 
 * This software is provided without warranty. The author(s) disclaim liability for damages
 * related to this software. All risk is assumed by you.
 * 
 */

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

#include "dfwmalloc_cxx.h"

/****************************************************************/

extern dfwmalloc_class my_object;

class my_class : public malloc_object<dfwmalloc_class, my_object>
{
  public:
    my_class();
    ~my_class();
    void my_method1();
    void my_method2();
    void my_method3();

  private:
    int my_var1;
    int my_var2;
    int my_var3;
};


/****************************************************************/

dfwmalloc_class my_object(sizeof (my_class));


my_class::my_class()
{
    printf("my_class::my_class\n");
}

my_class::~my_class()
{
    printf("my_class::~my_class\n");
}

int main(int argc, char **argv)
{
    (void) argc;
    (void) argv;
    printf ("sizeof (dfwmalloc_class) = %d\n", (int) sizeof (dfwmalloc_class));
    my_class *o1, *o2;
    printf ("start\n");
    o1 = new my_class ();
    o2 = new my_class ();
    delete o1;
    delete o2;
    printf ("end\n");
}


