Search Results

Search found 3 results on 1 pages for 'gkid123'.

Page 1/1 | 1 

  • OO design - car rental

    - by gkid123
    AnHow would you implement the following car hierarchy along with the accessor functions and a CarRental class which contains the container to store them? A car rental company wants to keep track of its cars. Each vehicle has a license plate and a brand. Currently the company has SUV and Sedans. SUV have an optional third row seat, sedan’s have an optional sport package. Each car can be queried to inquire the number of passengers it can carry.

    Read the article

  • Initialize data using memset

    - by gkid123
    memset to initilize data member- What is the benefit of initializing this way? Does it work in this example? Does it work in general ? Is it a good idea in general? class A { public: A(); private: int a; float f; char str[35]; long *lp; }; A::A() { memset(this, 0, sizeof(*this)); }

    Read the article

  • Implement the Combine function using templates

    - by gkid123
    any idea on how to do it for template? thanks Implement the Combine function using templates. The Combine fn applies a function of two arguments cumulatively to the items of an STL container, from begin() to end(), so as to reduce the sequence to a single value. For example, Combine(<list containing 6,3,1,9,7>, std::plus<int>()) should calculate ((((6+3)+1)+9)+7). class NotEnoughElements {}; template <typename Container, typename Function> typename Container::value_type Combine(const Container& c, Function fn) throw (NotEnoughElements) { your code goes here }

    Read the article

1