Git Product home page Git Product logo

manuel-project3's Introduction

Manuel-Project3

vg101 project 3

Singleton 是单例, 用法如下:Singleton &a=getInstance(); a前面一定要加&, 不然就是在调用protected的constructor

Vehicle 这个类我把index(size)这个attribute取消了,原因是我有一个map来联系一辆车和它停车的单价。

Map: map是这样的,map<key, value> 在map中每个key都对应唯一的一个value. 有一个find函数 find(key),返回的是指向那一组的迭代器的指针(iterator),可以被理解为 一个结构体,里面有两个成员,first和second。 而iterator.first 就是key,iterator.second就是value。

范围for: for(auto & iter: typePrice) 被称为范围for语句,用处是遍历某个对象, iter是迭代器的名字, typePrice是我要遍历的对象,&是引用(reference)的标志, auto代表编译器自动帮我判断iter的类型, 它如果被完整地写出来应该是TypePrice::iterator, 由于这个名字太长了,所以用auto。

Vehicle里面我加了一个getType函数

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.