Click here to Skip to main content
15,922,315 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Where do I write questions in C? Pin
gizmokaka7-Sep-07 2:26
gizmokaka7-Sep-07 2:26 
GeneralRe: Where do I write questions in C? [modified] Pin
jhwurmbach7-Sep-07 2:36
jhwurmbach7-Sep-07 2:36 
GeneralRe: Where do I write questions in C? Pin
gizmokaka7-Sep-07 2:57
gizmokaka7-Sep-07 2:57 
GeneralRe: Where do I write questions in C? Pin
jhwurmbach7-Sep-07 2:58
jhwurmbach7-Sep-07 2:58 
GeneralRe: Where do I write questions in C? Pin
gizmokaka7-Sep-07 6:23
gizmokaka7-Sep-07 6:23 
GeneralRe: Where do I write questions in C? Pin
jhwurmbach7-Sep-07 6:24
jhwurmbach7-Sep-07 6:24 
GeneralRe: Where do I write questions in C? Pin
El Corazon7-Sep-07 3:38
El Corazon7-Sep-07 3:38 
GeneralRe: Where do I write questions in C? Pin
Russell'7-Sep-07 22:58
Russell'7-Sep-07 22:58 
Simply let your code be something like this:

file.cpp

#include "file.h"
struct{
   int tagA;
   int tagB;
};

setTagA(..){..}  //public
setTagB(..){..}  //public
getTagA(..){..}  //public
getTagB(..){..}  //public
Operation1OnStruct(..){..}  //private
Operation2OnStruct(..){..}  //private
....
OperationNOnStruct(..){..}  //private
PublicOperation1OnStruct(..){..}  //public
PublicOperation2OnStruct(..){..}  //public
PublicOperation3OnStruct(..){..}  //public



file.h

setTagA(..);
setTagB(..);
getTagA(..);
getTagB(..);
PublicOperation1OnStruct(..);
PublicOperation2OnStruct(..);
PublicOperation3OnStruct(..);


In this way the user can only use the public operations on the struct, but not the private ones because on the .h file you will put only declarations of public functions.
In file.cpp you have to define first the struct, then every function (public or private).
Important: the order!
First declare the struct and include the file.h, then define public and private functions.
the private functions on the cpp file can use each other ONLY if they calls function jet defined/declared. So the private Operation2OnStruct(..) can use Operation1OnStruct(..) but not OperationNOnStruct(..). Then if you want add some prototipes of the private function at the beginning of the file.
Rose | [Rose]


Russell

QuestionIntelliSense and Sockets Pin
baerten6-Sep-07 21:52
baerten6-Sep-07 21:52 
AnswerRe: IntelliSense and Sockets Pin
Naveen6-Sep-07 23:20
Naveen6-Sep-07 23:20 
AnswerRe: IntelliSense and Sockets Pin
krmed7-Sep-07 0:48
krmed7-Sep-07 0:48 
QuestionProblem about draw text Pin
kcynic6-Sep-07 21:31
kcynic6-Sep-07 21:31 
AnswerRe: Problem about draw text Pin
KarstenK6-Sep-07 21:38
mveKarstenK6-Sep-07 21:38 
AnswerRe: Problem about draw text Pin
Nishad S6-Sep-07 21:54
Nishad S6-Sep-07 21:54 
AnswerRe: Problem about draw text Pin
Naveen6-Sep-07 22:26
Naveen6-Sep-07 22:26 
GeneralRe: Problem about draw text Pin
Nishad S6-Sep-07 22:30
Nishad S6-Sep-07 22:30 
GeneralRe: Problem about draw text Pin
Naveen6-Sep-07 22:34
Naveen6-Sep-07 22:34 
GeneralRe: Problem about draw text Pin
Nishad S7-Sep-07 0:52
Nishad S7-Sep-07 0:52 
GeneralRe: Problem about draw text Pin
Naveen7-Sep-07 0:56
Naveen7-Sep-07 0:56 
GeneralRe: Problem about draw text Pin
Nishad S7-Sep-07 1:29
Nishad S7-Sep-07 1:29 
GeneralRe: Problem about draw text Pin
kcynic7-Sep-07 1:16
kcynic7-Sep-07 1:16 
GeneralRe: Problem about draw text Pin
Nishad S7-Sep-07 1:26
Nishad S7-Sep-07 1:26 
GeneralRe: Problem about draw text Pin
kcynic7-Sep-07 3:55
kcynic7-Sep-07 3:55 
GeneralRe: Problem about draw text Pin
Nishad S8-Sep-07 0:47
Nishad S8-Sep-07 0:47 
GeneralRe: Problem about draw text Pin
kcynic8-Sep-07 2:08
kcynic8-Sep-07 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.