CMPSC 32 Lecture Notes - Lecture 2: Access Control, In C, Call Site
Document Summary
Use dot operator to get members of an object. Object is to struct as instance is to class (to some degree) For struct, every member (ivar, method) is public. Smaller projects have less access control --> prefer struct. Example: struct date { int month; int day; int year; Safer operation x = p->x; p is a pointer. In c++, you would declare p without a * Usually allowed only for small structs that are passed around by value. Anything more complicated has private sections and possibly filters for setting p. x = 3 looks like plain assignment. The left hand side is called the lvalue. Could be a whole filter on that 3. Constructors are universally invoked by name of class or struct used like a function call. Can sometimes accomplish creating objects with the values you want with default variables in the declaration void func(int a, int b = 47);