User Tools

Site Tools


docs:c_basics

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:c_basics [2009/02/16 08:18]
gibson opr
docs:c_basics [2010/02/02 07:55] (current)
Line 30: Line 30:
  
 Some C++ vocabulary Some C++ vocabulary
-   * a user-defined type is called a **class**. %%Matrix%% is a class. Classes are roughly like fundamental types. +   * a user-defined type is called a **class**; e.g. %%Matrix%% is a class. Classes are roughly like fundamental types. 
-   * variables of user-defined types are often called **objects**. %%A%% is an object of type %%Matrix%%. +   * variables of user-defined types are often called **objects**, e.g.  ​%%A%% is an object of type %%Matrix%%. 
-   * objects are initialized or **constructed** by **constructors** ​ %%Matrix A(M,N)%% constructs an object named %%x%%. The %%(M,N)%% is an argument list for the %%Matrix%% constructor,​ in this case the row and columns dimensions. Constructors typically allocate memory and assign initial values to the object'​s internal data structures.  +   * objects are initialized or **constructed** by **constructors**, e.g. the statement ​%%Matrix A(M,N);%% constructs an %%M x N%% Matrix ​object named %%x%%. The %%(M,N)%% is an argument list for the %%Matrix%% constructor,​ in this case the row and columns dimensions. Constructors typically allocate memory and assign initial values to the object'​s internal data structures.  
-   * Classes have **member functions** and **operators**. ​ %%A*x%% calls the %%Matrix, Vector%% multiplication ​operation, and %%y.dim()%% calls the %%dim()%% member function of object %%y%%.+   * Classes have **member functions** and **operators**. ​ %%A*x%% calls the %%Matrix, Vector%% multiplication ​operator, and %%y.dim()%% calls the %%dim()%% member function of object %%y%%.
    * %%cout << y << endl%% prints object %%y%% to standard output followed by a new line.     * %%cout << y << endl%% prints object %%y%% to standard output followed by a new line. 
  
docs/c_basics.1234801088.txt.gz · Last modified: 2009/02/16 08:18 by gibson