docs: add installation prerequisites and quickstart guide to README
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
class Point {
|
||||
int x = 10;
|
||||
int y = 20;
|
||||
|
||||
void print(int obj) {
|
||||
printf("Point(%d, %d)\n", obj.x, obj.y);
|
||||
}
|
||||
|
||||
int getX(int obj) {
|
||||
return obj.x;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
printf("=== Working OOP Test ===\n\n");
|
||||
|
||||
printf("Test 1: Create object (using int to hold pointer)\n");
|
||||
int p = new Point();
|
||||
printf("Object created\n\n");
|
||||
|
||||
printf("Test 2: Access field\n");
|
||||
printf("p.x = %d\n", p.x);
|
||||
printf("p.y = %d\n\n", p.y);
|
||||
|
||||
printf("Test 3: Call method\n");
|
||||
p.print();
|
||||
printf("\n");
|
||||
|
||||
printf("Test 4: Call getter\n");
|
||||
int x_val = p.getX();
|
||||
printf("Got x = %d\n\n", x_val);
|
||||
|
||||
printf("Test 5: Null check\n");
|
||||
int n = null;
|
||||
printf("null value = %d\n\n", n);
|
||||
|
||||
printf("=== All Tests Passed ===\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user