Thinking In C ++ Read Notes (Chapter 1)

xiaoxiao2021-03-06  45

Just 20th, I just bought books, I am obviously open source, and I have to be nearly 60 yuan, black is really! Corning into the topic: Looking at the preamble, probably introducing it, there is a pile of recommendations. Really let me excite too! See C way changing! Bjarne Stroustrup: C is a recognor Purpose Programming Language, Not Just A Object-Oriented Programming Language. Does INTRODUCTION? Do you have anything! Later, the object and class abstraction method are coming to see the problem, all things are objects, and objects are nature, so the objects use abstract classes, which are common to them. Five Principles: 1, all things are objects (so that the procedure can be subsequently divided into group) 2. Objects exchange (function call request) 3, object interlaced (possibilities of more complex programs) 4, all objects have Attributes (possibly possible) 5, all objects of a class can accept the same message (possibly possible) model: class (abstraction) - instance / object (specific) resolve theory and actual combination difficult: Interface Interface (Function) Model:

Object-interface

Object: Features (Data Elements) - Behavior (Features) You can see the definition of int (built-in class) and Class definition purposes are consistent (user-defined class) class, type C implementation: Class 2 Features package: Realization of classes, avoid exposure and errors of complexity, privacy models:

programmer

(Class creator) -

Customer users

(Customer programmer) C implementation: Access Specifer Access Configuration Public: Public Interface (External Function Access) Protected: Protection Interface (Accessible in Inherited Class in External Function) PRAVITE: Internal Interface (Internal Function Access) Inheritance (for reuse) inheritance: Take further abstract model: base class (class // my language) - derive class (super class / parent class) - (inherited / subclass) Inheritance mode: Modify the interface function (pure inheritance pure inherent) function overload OVER-RIDDING IS-A Increase the interface function of the derived class is-like-a (base class cannot call the derived "new function) Another way: Aggregation (Combination Composition) Different types of objects constitute new classes (create a member object) HAS-A flexibility polymorphism: inherited personality efficiency problem: (IS-a) I hope to be legally derived by operating base class functions Class implementation processing derived type is like processing basic types of processes (to top type transformation Upcasting) Ensure from the base class function to ensure the correctness of the inheritance function: EG base category move () -> derive class 1.move () derived class 2.Move () other languages: Bundle Early Binding C : late Bundle Late Binding (Compiler to Function Don't know the specific type and object a number) keyword Virtual (first impression) 3, the creation of the object (further understanding after further):

Heap Stack Dynamic Distribution Speed ​​Slow Slow Virtual Memory Not Follow Details Flexible Stack Heap Static Assignment Speed ​​Fast Quantity Small Memory Follow Details (Function Life) C Implement: Dynamic Assignment New Creating Object Delete Destruction Object [Method] (Skip)

转载请注明原文地址:https://www.9cbs.com/read-55927.html

New Post(0)