Newer
Older
Import / research / XPlat / hello.cpp
@John Ryland John Ryland on 22 Dec 2020 679 bytes import NUC files
#include <stdio.h>

class John
{
  public:
    John(int a, int b);
    ~John();

    int helloClass(int x, int y);
    void dump();

  private:
    int p, q;
};


John::John(int a, int b) : p(a), q(b) { }
John::~John() { }
int John::helloClass(int x, int y) { return (x+p)*(y+q); }
void John::dump() { printf("John(%i,%i)\n", p, q); }


int hello(int x, int y)
{
    printf("hello called\n");
    John *obj = new John(4,5);
    printf("expect 35, got: %i\n", obj->helloClass(1,2));
    obj->dump();
    delete obj;
    return (x + y) * y;
}

int blah()
{
    John o(1,2);
    o.dump();
}

/*
int main(int argc, char *argv[])
{
	printf("hello world\n");
	return hello(10,2);
}
*/