notes:cprog:spring2024:projects:cppx
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog:spring2024:projects:cppx [2024/04/17 03:41] – [Objects] hcopp1 | notes:cprog:spring2024:projects:cppx [2024/04/24 12:23] (current) – [Classes] amelvil2 | ||
---|---|---|---|
Line 1: | Line 1: | ||
======CPPX====== | ======CPPX====== | ||
=====C++ compiler===== | =====C++ compiler===== | ||
+ | To compile a C++ script, you can use g++ -o (new name) (uncompiled name).cpp | ||
+ | |||
+ | For example, to compile a script called script.cpp: | ||
+ | < | ||
====common file extensions==== | ====common file extensions==== | ||
Line 25: | 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: | ||
+ | |||
+ | < | ||
+ | // Define the class | ||
+ | class MyClass { | ||
+ | // Class members go here | ||
+ | }; | ||
+ | </ | ||
====Member Functions==== | ====Member Functions==== | ||
Line 151: | Line 163: | ||
Class members declared as '' | Class members declared as '' | ||
+ | |||
+ | For example: | ||
+ | |||
+ | < | ||
+ | class MyClass { | ||
+ | public: | ||
+ | int publicMember; | ||
+ | }; | ||
+ | </ | ||
===Private=== | ===Private=== | ||
Class members declared as '' | Class members declared as '' | ||
+ | |||
+ | For example: | ||
+ | |||
+ | < | ||
+ | class MyClass { | ||
+ | private: | ||
+ | int privateMember; | ||
+ | }; | ||
+ | </ | ||
===Protected=== | ===Protected=== | ||
Line 160: | Line 190: | ||
Class members declared as '' | Class members declared as '' | ||
+ | For example: | ||
+ | |||
+ | < | ||
+ | class MyClass { | ||
+ | protected: | ||
+ | int protectedMember; | ||
+ | }; | ||
+ | </ | ||
=====Objects===== | =====Objects===== | ||
notes/cprog/spring2024/projects/cppx.1713339719.txt.gz · Last modified: 2024/04/17 03:41 by hcopp1