Click here to Skip to main content
15,887,432 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OOP is driving me crazy! Pin
CPallini11-Dec-07 21:42
mveCPallini11-Dec-07 21:42 
GeneralRe: OOP is driving me crazy! Pin
led mike12-Dec-07 5:16
led mike12-Dec-07 5:16 
GeneralRe: OOP is driving me crazy! Pin
CPallini12-Dec-07 5:25
mveCPallini12-Dec-07 5:25 
GeneralRe: OOP is driving me crazy! Pin
CPallini11-Dec-07 0:33
mveCPallini11-Dec-07 0:33 
GeneralRe: OOP is driving me crazy! Pin
led mike11-Dec-07 4:58
led mike11-Dec-07 4:58 
GeneralRe: OOP is driving me crazy! [modified] Pin
CPallini11-Dec-07 5:05
mveCPallini11-Dec-07 5:05 
GeneralRe: OOP is driving me crazy! Pin
Nelek10-Dec-07 23:45
protectorNelek10-Dec-07 23:45 
GeneralRe: OOP is driving me crazy! Pin
Matthew Faithfull11-Dec-07 0:03
Matthew Faithfull11-Dec-07 0:03 
Lord Kixdemp wrote:
C++ doesn't allow Client to know anything about Dialog.


Here's the clue. C++ allows Client only to know that Dialog is a Dialog, i.e the public interface of the Dialog class. This is painful because it restricts what Client knows and you have to make everything about Dialog you want accessible available as part of the public interface but it's great in the long term because Client doesn't care which Dilaog it is or even what sort of Dialog as long as it is a Dialog class the code will work. Do it in C and it'll be done in half the time and obselete and unmaintainable in months. In C++ it might take a while to do but you'll still be using bits of it when you're old and grey. Smile | :)
I port a lot of C code to C++ so here's a method you might be able to simulate if you find it easier to think in C.
I take each C source file and turn it into a class.
Every file static variable becomes a member variable, every function extern(ed) in any other file becomes a public member function.
Every little utility function not extern(ed) becomes a private member function.
Then I create one single file static instance of the class. This gets me a half way house between C and C++ and by the time a whole project has been tranformed like this I can see what the public interfaces need to be and how the instancing of each class should be controlled. What owns what. Eventually all the file level statics disappear and the large classes are reworked into objects that match the required instancing pattern. OOP is not so hard after all. Smile | :)

Nothing is exactly what it seems but everything with seems can be unpicked.

GeneralRe: OOP is driving me crazy! Pin
Lord Kixdemp11-Dec-07 0:15
Lord Kixdemp11-Dec-07 0:15 
GeneralRe: OOP is driving me crazy! Pin
Lord Kixdemp11-Dec-07 0:15
Lord Kixdemp11-Dec-07 0:15 
GeneralRe: OOP is driving me crazy! Pin
led mike11-Dec-07 5:10
led mike11-Dec-07 5:10 
GeneralRe: OOP is driving me crazy! Pin
Lord Kixdemp11-Dec-07 18:12
Lord Kixdemp11-Dec-07 18:12 
GeneralRe: OOP is driving me crazy! Pin
led mike12-Dec-07 5:31
led mike12-Dec-07 5:31 
GeneralRe: OOP is driving me crazy! Pin
KarstenK11-Dec-07 2:00
mveKarstenK11-Dec-07 2:00 
QuestionIs anybody to solve my probblem Pin
rajneshmalik10-Dec-07 22:19
rajneshmalik10-Dec-07 22:19 
GeneralRe: Is anybody to solve my probblem Pin
Nelek10-Dec-07 23:42
protectorNelek10-Dec-07 23:42 
GeneralLoading an ICON from a file Pin
eli1502197910-Dec-07 22:18
eli1502197910-Dec-07 22:18 
GeneralRe: Loading an ICON from a file Pin
CPallini10-Dec-07 22:42
mveCPallini10-Dec-07 22:42 
GeneralRe: Loading an ICON from a file Pin
eli1502197910-Dec-07 22:54
eli1502197910-Dec-07 22:54 
GeneralRe: Loading an ICON from a file Pin
Naveen10-Dec-07 23:25
Naveen10-Dec-07 23:25 
QuestionRe: Loading an ICON from a file Pin
Hamid_RT11-Dec-07 0:02
Hamid_RT11-Dec-07 0:02 
GeneralMAPI to MIME Pin
monsieur_jj10-Dec-07 21:40
monsieur_jj10-Dec-07 21:40 
QuestionProblem in opening the HTML file. Pin
sanjeeva K Kanakam10-Dec-07 21:30
sanjeeva K Kanakam10-Dec-07 21:30 
GeneralRe: Problem in opening the HTML file. Pin
Christian Graus10-Dec-07 22:19
protectorChristian Graus10-Dec-07 22:19 
QuestionRe: Problem in opening the HTML file. Pin
Hamid_RT11-Dec-07 0:02
Hamid_RT11-Dec-07 0:02 

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.