Hi all.
This is my first attempt a OO in C++. I'm sure there are some obvious mistakes. I know there must be more than one way to do this, but I would like to follow a partial example I was given and leave the first 15 lines unchanged (if possible) and continue using stdio.h too.
I might respond with slightly different approaches for critiquing in the thread too; the key point is I'm just trying to learn.
Thanks in advance.Code:#include <stdio.h> #include <stdlib.h> class SomeClass{ private: int x; int y; int z; public: SomeClass(int x, int y, int z){ this->x = x; this->y = y; this->z = z; } void print(SomeClass z){ print("%d %d %d\n", z.x, z.y, z.z); } }; int main(){ SomeClass a (1, 2, 3); SomeClass b (4, 5, 6); print(a); print(b); return 0; }



LinkBack URL
About LinkBacks




