Advertisement

OffTopic: OOP question

Started by July 08, 2001 10:15 PM
7 comments, last by Jackthemeangiant 23 years, 7 months ago
Hey, This post is a bit off topic, but I don''t know where else to ask. I am switching from programming my OpenGL programs in Delphi to MSVC++, and I am having trouble setting up my Hierarchy. My question is, if 1 object inherits another, do you use separate source files for them?...or just 1? Thanks alot, Jack

They can be in seperate files or the same one it doesn''t matter. As long as you include the right headers you should be fine.

-------
Andrew
"Power comes in response to a need not a desire."
gdNgine Development
Advertisement
Just to expand on what acraig said...

One file (bad):
  // c1.cpp  class c1 {    public:      int c1_property;  }  class c2 : public c1 {    public:      int c2_property;  } 


Many files (better):
  // c1.h  class c1 {    public:      int c1_property;  }  // c2.h  #include "c1.h"  class c2 : public c1 {    public:      int c2_property;  } 


Both work fine, but the later is better cuz each class is separate.

Jinushaun
just a quick question... why are you swapping from delphi to cpp? most people are enlightened and go the other way...

seriously, why? because you can do everything in delphi that you can in cpp, and often it''s easier and much more elegant / easier to read. just my opinion of course, but i''d be interested in hearing why you''re swapping.
That is a good question, but I find Delphi too easy...

and I find that most ppl laugh at me when I tell them I program in Pascal.

Plus I heard that C++ runs faster.



Edited by - jackthemeangiant on July 10, 2001 6:24:20 PM
Hey, Delphi (Pascal) is not that bad, Its just easy that''s all. Speed is not a big diffrence nowdays. Don''t be afraid just because your friends laugh at you because you are using Pascal, if you can do better than them, why not.

I''m a Delphi User. But if someday I Move to C++ than it would be because of some Library Problems (Can''t get the DX8 SDK for Delphi that easy, good thing OGL is supported here)
Help me with my Isometric OpenGL engine.
Advertisement
The thing that I find is, that if I am programming in Delphi, times will come where I wish I was programming it in C++ becauase it maby easier to do what I want to do, or Delphi can''t do what I want to do (i.e. write an ADT to a file)

but the same is with C++, there will be times when a section of what I am writing would be so much easier to write in Delphi.


~Jack
as far as the speed thing goes, compiled delphi is just as fast as compiled (borland) c++. I don''t know what the speed''s like compared to msvc++, but borland''s compilers are famous and have been for years, both for speed and stability.

Don''t forget that both delphi and borland c++ have the same engine underneath them... in fact, all the borland c++ components (and i think some other important parts of the system) are written in delphi!
I''m not saying this is fact, but from what I''ve been told talking to someone who writes _very_ complicated delphi apps, it has some serious problems with memory usage, causing a small change in one unrelated portion of the app to completly break another, totally unrelated part of it. But I''m talking _HUGE_ projects here, possibly hitting 1/2 million lines, or so.
but it may be that he is just a bad programmer

This topic is closed to new replies.

Advertisement