随笔分类 - 计算机程序设计(C++)课程
学习C++ primer plus一书的内容
摘要:17.3 Input with cin Typically, you use as follows: C++ redefines for handling input with . It is overloaded for the basic types of C++, as well as the
阅读全文
摘要:17.1 An Overview of C++ Input and Output Unlike other languages that place I/O in keywords, C and C++ leaves I/O purely to implementers. C++'s solutio
阅读全文
摘要:16.4 Generic programming A goal of generic programming is to write code that is independent of data types. The STL goes further by providing a generic
阅读全文
摘要:(这已经是第二次博客园吞我东西了,有点心态爆炸) 16.1 The string Class ) Constructing a string Here is a table which shows the seven form of constructors that the class has:
阅读全文
摘要:// 这个part因为网络问题被吞了一部分 15.3 Exceptions ) Calling When you already know the conditions of failure, you may detect them and call if true to terminate the
阅读全文
摘要:15.1 Friends ) When you want to make class A's private members accessible to class B, let B be a friend class of A by declaring `friend class B;': Sup
阅读全文
摘要:14.4 Class Templates ) Templates provide parameterized types, which is capable of passing a type name as a recipe for building a class or a function.
阅读全文
摘要:14.1 Classes with object members ) The valarray class To declare an object, you follow the identifier with angle brackets that contain the desired typ
阅读全文
摘要:Noteworthy: 1 constructors of the derived class use member initializer list syntax to initialize base class private members: 2 A derived class method
阅读全文
摘要:class inheritance lets you derive new classes from old ones, inheriting its properties of the old class, called the base class With inheritance, you c
阅读全文
摘要:12.7 A queue simulation ) queue: FIFO(first in first out), just like regular queue in the waiting line ) stack: LIFO(last in first out), just like a p
阅读全文
摘要:12.3 Things to remember when using new in constructors ) If you use new in constructors, use delete in destructor. Their use should be compatible, pai
阅读全文
摘要:12.1 Dynamic memory and classes 12.1.1 A review example and static class members Now try implement a String class(a flawed one): // sayings1.cpp using
阅读全文
摘要:11.5.3 An implementation comment ) The separation of interface from implementation is one of the goals of OOP. ) Example of the implementation of the
阅读全文
摘要:11.1 Operator overloading ) Operator overloading is an example of C++ polymorphism. It allows you to extend operator overloading to user defined types
阅读全文
摘要:10.5 An array of objects ) You can define an array of objects just as an array of built in types: Declaring without initialization requires the class
阅读全文
摘要:10.2.4 Using classes Following exapmle uses the class definition and implementation written in previous files: ) The code below is a client: client :
阅读全文
摘要:10.1 Procedural and object oriented programming ) In procedural programming, you first concentrate on the procedures you will follow ) In OOP, you con
阅读全文
摘要:9.3 Namespaces namespace problems The conflict of using same name things from different libraries. For example, two libraries might both define classe
阅读全文
摘要:9.2.10 Storage schemes and dynamic allocation Memory allocated by new operator is called dynamic memory. Dynamic memory is controlled by new and delet
阅读全文

浙公网安备 33010602011771号