目前分類:C / Cpp (75)

瀏覽方式: 標題列表 簡短摘要

null pointer is a special pointer value that is known not to point anywhere.

The most straightforward way to ``get'' a null pointer in your program is by using the predefined constant NULL.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

#include <string>
using namespace std;

JerryCheng 發表在 痞客邦 留言(0) 人氣()

We can use reference as alias of a variable , 

for example :

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在polymorphism中 , 我們可以將base class轉換成許多不同的derived class , 

我們也解釋說 , 這個意思就像是employee (base class) 可以是manager , 也可以是engineer , operator .

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Abstract class is also called interface class . An interface class is a class that has no members variables, 

and where all of the functions are pure virtual! In other words, the class is purely a definition, and has no actual implementation.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Inheritance in C++ takes place between classes. When one class inherits from another, 

the derived class inherits the variables and functions of the base class. 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

A member function with the same name as its class is called a constructor. 

A constructor defines a way to initialize an object of its class.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Exceptions in C++ are implemented using three keywords that work in conjunction with each other: throwtry, and catch.


JerryCheng 發表在 痞客邦 留言(0) 人氣()

virtual function is a special type of function that resolves to the 
most-derived version of the function with the same signature.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

In programming languages, polymorphism means that some code or operations or objects behave differently in different contexts.

For example, the + (plus) operator in C++:

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Code written in-place is significantly faster , so C++ offers a way to combine the advantages of functions 

with the speed of code written in-place: inline functions.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

We can read a line by using getline function.

There are two situation , we know the size of a line , or 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

A template expression parameter is a parameter that does not substitute for a type, 

but is instead replaced by a value.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Template class is similar to function template , 

We can use the template to instead of type of variable or method of class.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

First , let us see the follow two functions :

JerryCheng 發表在 痞客邦 留言(0) 人氣()

friend class is a class that can access the private members of a class as though it were a member of that class.

we can define an entire class as a friend as follow :

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Multiple inheritance enables a derived class to inherit members from more than one parent.


JerryCheng 發表在 痞客邦 留言(0) 人氣()

When one class inherits from another, the derived class inherits the variables and functions of the base class. 

These variables and functions become part of the derived class.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Static member function means that we  can be called directly by using the class name and the scope operator.

for example :

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Static member variable

Static member variable is similar to global variable , but it is applied to class.

JerryCheng 發表在 痞客邦 留言(0) 人氣()