Boost logo

Boost Users :

From: Richard Dingwall (rdingwall_at_[hidden])
Date: 2008-07-21 07:21:09


On Mon, Jul 21, 2008 at 10:57 PM, Ákos Maróy <akos_at_[hidden]> wrote:
> - how do I create an instance of the same name as its type?

I would either A) try and find a better name for the type, or B) find
a better name for the instance.

If the instance has a very brief lifetime, limited scope, or is
otherwise obvious to a developer (e.g. the single parameter to a
string utility function), I might abbreviate it's name, usually right
down to a single character.

string s = "Richard";

> - how do I declare accessor functions to private members?
> ...
> should I put some prefix to the private member's name?

Not a prefix, but a a trailing underscore suffix is generally used
(identifiers starting with an underscore are reserved for the
compiler).

class foo
{
public:
        int bar() const { return bar_; }
private:
        int bar_;
};

Cheers,

Rich


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net