in the class definition below I have chosen to declare certain items as private versus public. what does one use as the basis of deciding what is public and what is private.
I know that private protects certain elements from outside sources but the only outside source I can think of is the programmer himself. Though I am sure there are other instances were the variable or other item can be accessed outside my code. Other than creating exceptionally bullet proof code I sometimes wonder why use private at all.
I would be grateful for someone to recommend a source that would help me make the decisions neccessary
thanx in advance
tomcruz.net
I know that private protects certain elements from outside sources but the only outside source I can think of is the programmer himself. Though I am sure there are other instances were the variable or other item can be accessed outside my code. Other than creating exceptionally bullet proof code I sometimes wonder why use private at all.
I would be grateful for someone to recommend a source that would help me make the decisions neccessary
Code:
class MHDBTable
{
// For all functions with a return type of int, the value
// of 0 is for no error and 1 is for an error (unspecified).
private:
bool active;
int _Insert;
int _DataOffset;
int slack;
int _RecNo;
char *_Record;
char *_TableName;
char *Blank;
char *buff;
int _TableVersion;
int _MDBEVersion;
int _RecordLength;
char header [HEADERLENGTH];
void __fastcall HeaderInitialize (void);
public:
__fastcall MHDBTable ();
__fastcall ~MHDBTable ();
vector<string> Records;
field *Fields;
int __fastcall Open (void);
int __fastcall Close (void);
int __fastcall CreateTable (void);
bool __fastcall Active (void);
char* __fastcall TableName (void);
int __fastcall TableName (char *str);
char* __fastcall Record (void);
int __fastcall Record (char *string);
int __fastcall RecordLength (void);
int __fastcall RecNo (int recno);
int __fastcall RecNo (void);
int __fastcall First (void);
int __fastcall Next (void);
int __fastcall Prior (void);
int __fastcall Last (void);
int __fastcall Insert (void);
int __fastcall Delete (void);
int __fastcall Post (void);
int __fastcall InsertStatus (void);
int __fastcall InsertStatus (bool stat);
int __fastcall Pack (void);
int __fastcall Slack (void);
int __fastcall DataOffset (void);
char __fastcall Version (void);
char __fastcall MDBEVersion (void);
int __fastcall LoadRecord (field *fields, char *record, int recordlength);
int __fastcall Locate (char *KeyFields, char *KeyValues, int options);
};
thanx in advance
tomcruz.net