User Tools

Site Tools


notes:cprog:spring2024:projects:cppx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:cprog:spring2024:projects:cppx [2024/04/17 15:17] – [Access Control] amelvil2notes:cprog:spring2024:projects:cppx [2024/04/24 12:23] (current) – [Classes] amelvil2
Line 29: Line 29:
   * The public members form an interface to the class and are accessible outside the class.   * The public members form an interface to the class and are accessible outside the class.
  
 +For example:
 +
 +<code>
 +// Define the class
 +class MyClass {
 +    // Class members go here
 +};
 +</code>
 ====Member Functions==== ====Member Functions====
  
Line 155: Line 163:
  
 Class members declared as ''public'' can be used by any function. Class members declared as ''public'' can be used by any function.
 +
 +For example:
  
 <code> <code>
Line 166: Line 176:
  
 Class members declared as ''private'' can be used only by member functions and friends (classes or functions) of the class. Class members declared as ''private'' can be used only by member functions and friends (classes or functions) of the class.
 +
 +For example:
  
 <code> <code>
Line 177: Line 189:
  
 Class members declared as ''protected'' can be used by member functions and friends (classes or functions) of the class. Additionally, they can be used by classes derived from the class. Class members declared as ''protected'' can be used by member functions and friends (classes or functions) of the class. Additionally, they can be used by classes derived from the class.
 +
 +For example:
  
 <code> <code>
notes/cprog/spring2024/projects/cppx.1713381428.txt.gz · Last modified: 2024/04/17 15:17 by amelvil2