home *** CD-ROM | disk | FTP | other *** search
- From: wright@hpcc01.corp.hp.com (Jeff Wright)
- Date: Fri, 24 Jul 1992 19:45:52 GMT
- Subject: Re: Programming guidelines: naming of data members?
- Message-ID: <1000003@hpcc01.corp.hp.com>
- Organization: HP IC Business Div Palo Alto
- Path: sparky!uunet!usc!sdd.hp.com!hpscdc!hplextra!hpcc05!hpcc01!wright
- Newsgroups: comp.lang.c++
- References: <1992Jul17.204822.9087@bcrka451.bnr.ca>
- Lines: 23
-
- > 1. What conventions do you like for naming private and protected data
- > members? Why?
- >
- > 2. What naming conventions do you use for get/set functions?
-
- I investigated this a couple of months ago and decided to go with the
- following approach:
-
- class Example
- {
- public:
- void num(int aNum) { theNum = aNum; }
- int num() const { return theNum; }
- private:
- int theNum;
- };
-
- It's a little more verbose than underscores or single-letter prefixes,
- but I like it pretty well. Plus you don't have so many "gets" and "sets".
-
-
- --Jeff Wright HP IC Business Division--Palo Alto
- wright@hpctgrd.hpl.hp.com (HPtelnet/415) 857-5351
-