A 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.
A 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.
#include <string>
using namespace std;
在polymorphism中 , 我們可以將base class轉換成許多不同的derived class ,
我們也解釋說 , 這個意思就像是employee (base class) 可以是manager , 也可以是engineer , operator .
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.
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.
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.
Exceptions in C++ are implemented using three keywords that work in conjunction with each other: throw, try, and catch.
A virtual function is a special type of function that resolves to the
most-derived version of the function with the same signature.
In programming languages, polymorphism means that some code or operations or objects behave differently in different contexts.
For example, the +
(plus) operator in C++:
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.
We can read a line by using getline function.
There are two situation , we know the size of a line , or
A template expression parameter is a parameter that does not substitute for a type,
but is instead replaced by a value.
Template class is similar to function template ,
We can use the template to instead of type of variable or method of class.
A 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 :
Multiple inheritance enables a derived class to inherit members from more than one parent.
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.
Static member function means that we can be called directly by using the class name and the scope operator.
for example :
Static member variable
Static member variable is similar to global variable , but it is applied to class.