本文共 979 字,大约阅读时间需要 3 分钟。
C++ programming language
C++ primer Effective C++ Third Edition The C++ Standard Library STL源码剖析object based:面对的是单一class的设计
object oriented:面对的是多重classes的设计,存在classes之间的联系C++包括C++语言和C++标准库,不会使用标准库不是好的C++程序员
C++ 代码包含头文件和主程序,标准库也是以头文件呈现
后缀名.h或.cpp不是固定的,根据平台而定#ifndef __COMPLEX__#define __COMPLEX__//...#endif
#includeusing namespace std;template class A{ private: T data;public: A(T num): data(num){ } void print(){ cout << data << endl; }};int main(){ A *p = new A (10.98); p->print(); return 0;}
class Shape{ public: virtual void draw() const = 0; virtual void error(const std::string& msg); int bojectID() const; ...}class Rectangle : public Shape{ };class Ellipse : public Shape{ };
转载地址:http://kmwrf.baihongyu.com/