Home / guide / beyond_cs302 / struct_func_ex.cpp
Directory Listing
calloc.c
hello_world.c
makefile
malloc_free.c
new_delete.cpp
realloc.c
string_ex1.c
string_ex2.c
struct_ex1.c
struct_ex1.cpp
struct_ex2.c
struct_func_ex.c
struct_func_ex.cpp
1
2
3
4
5
6
7
8
9
10
11
struct thing {
	int id;

	void set_id(int v) { id = v; }
};

int main() {
	thing foo;

	foo.set_id(2);
}