![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++类
文章平均质量分 85
nuoshueihe
这个作者很懒,什么都没留下…
展开
-
Abstract Class
Create an abstract class.#include using namespace std;class area { double dim1, dim2; public: void setarea(double d1, double d2) { dim1 = d1; dim2 = d2; } void getdim(double &d原创 2012-11-28 16:12:01 · 407 阅读 · 0 评论 -
<cmath> (math.h)
Trigonometric functions:cosCompute cosine (function)sinCompute sine (function)tanCompute tangent (function)acosCompute arc cosine (function)asinCompute arc sine (function原创 2012-12-20 10:20:18 · 1276 阅读 · 0 评论 -
<cstdio> (stdio.h)
FunctionsOperations on files:removeRemove file (function )renameRename file (function )tmpfileOpen a temporary file (function )tmpnamGenerate temporary filename (function )原创 2012-12-20 10:18:30 · 606 阅读 · 0 评论 -
<cstdlib> (stdlib.h)
FunctionsString conversion:atofConvert string to double (function )atoiConvert string to integer (function )atolConvert string to long integer (function )atollConvert string原创 2012-12-20 10:14:51 · 513 阅读 · 0 评论 -
<ctime> (time.h)
(time.h)C Time LibraryThis header file contains definitions of functions to get and manipulate date and time information.FunctionsTime manipulationclockClock program (function )原创 2012-12-20 10:12:17 · 713 阅读 · 0 评论 -
this
how the this class pointer works#include using namespace std;class MyClass { int i; public: void load_i(int val) { this->i = val; } int get_i(void) { return this->i; } }; main(原创 2012-11-29 10:03:32 · 460 阅读 · 0 评论 -
object pointer
Use object pointer to reference virtual method#include using namespace std;class Base { public: virtual void show_message(void) { cout << "This is the base class\n"; };};class Derived: publ原创 2012-11-29 09:55:38 · 534 阅读 · 0 评论 -
template class
template class with type parameter#include #include using namespace std;const int SIZE = 10;template class MyClass { T a[SIZE]; public: MyClass(void) { int i; for(i=0;原创 2012-11-29 13:58:13 · 2420 阅读 · 0 评论 -
inline
Inline functions may be class member functions#include using namespace std;class myclass { int a, b;public: void init(int i, int j); void show();};// Create an inline function.inline voi原创 2012-11-29 09:34:42 · 327 阅读 · 0 评论 -
Friend
friend class for each other#include #include using namespace std;class Curly { public: Curly(char *msg) { strcpy(message, msg); }; void show_message(void) { cout << message << endl; };原创 2012-11-29 09:30:49 · 405 阅读 · 0 评论 -
Interface
'Interface' for subclass#include using namespace std;class AreaClass {public: double height; double width;};class Rectangle : public AreaClass {public: Rectangle(double h, double w);原创 2012-11-29 09:40:29 · 356 阅读 · 0 评论 -
Copy Constructor
A copy constructor to allow StringClass objects to be passed to functions.#include #include #include using namespace std;class StringClass { char *p;public: StringClass(char *s);原创 2012-11-28 17:13:56 · 486 阅读 · 0 评论 -
reinterpret_cast,const_cast,static_cast,dynamic_cast 显式类型转换
reinterpret_cast,const_cast,static_cast,dynamic_cast 显式类型转换 Cpp代码 #include int main(void) { //reinterpret_cast //将一个类型指针转换为另一个类型指针,这种在转换不修改指针变量值数据存放格式 //只需在编译时重新解原创 2012-11-28 16:33:43 · 324 阅读 · 0 评论 -
cast
Don't need a cast to go up the inheritance hierarchyclass Base{public: Base() {}; virtual ~Base() {}};class Derived : public Base{public: Derived() {} virtual ~Derived() {}};int main原创 2012-11-28 16:21:30 · 460 阅读 · 0 评论 -
Linux下面的线程锁,条件变量以及信号量的使用
一) 线程锁1) 只能用于"锁"住临界代码区域2) 一个线程加的锁必须由该线程解锁.锁几乎是我们学习同步时最开始接触到的一个策略,也是最简单, 最直白的策略.二) 条件变量,与锁不同, 条件变量用于等待某个条件被触发1) 大体使用的伪码:// 线程一代码pthread_mutex_lock(&mutex);// 设置条件为truepthread_cond_signal(&c转载 2013-01-31 16:24:54 · 740 阅读 · 0 评论