Thread: C & C++ mix and use

  1. #1
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218

    C & C++ mix and use

    Hi ;

    I program in C but i know of C++ and eventhough i havent practiced in it but i can make simple stuff like declaring classes and initilizing constructors and bit more.

    im not good at more advance stuff like operator overloading and
    polymorph //// now why cant i use classes within the framework of a c program if it serves my purpose for instance in an 3d graphic program:like

    classcamera::movecamera(,,,,,,)
    classcamera::zoomcamera(,,,,,,)

    and after the use go back to my own C routins. of course i will use the right headers.but some ppl say this practice is not proper

    either C or C++ but i dont get it why?

    because i prefer C style but at times a simple C++ solution will cut tons of time wasted on coding.because structs dont have member functions.

    by the way does <iostream.h> include <stdio.h> in it?
    Last edited by SAMSAM; 02-15-2003 at 09:30 AM.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Include stdio manually.

    Kuphryn

  3. #3
    Registered User whistlenm1's Avatar
    Join Date
    Jan 2002
    Posts
    124
    As I understand your question, you can mix C++ features in a C program! Remember, before it was named C++ it was called C with classes. Now, I must admit I myself have not throughly exercised such practice and I have even theorized on how using template functions with stdio.h would work; as in everything else try it first, see what can and cannot be done, or in C\C++ manipulate to your needs. You will figure it out!
    Man's mind once streched by a new idea, never regains its original dimensions
    - Oliver Wendell Holmes

    In other words, if you teach your cat to bark (output) and eat dog food (input) that doesn't make him a dog. It would have to chase cars, chew bones, and have puppies before I'd call it Rover ;-)
    - WaltP

  4. #4
    samurai warrior nextus's Avatar
    Join Date
    Nov 2001
    Posts
    196
    isnt c++ backwards compatible..if it is just use a c++ compiler and code in c or c++

    (if i am wrong...forget what i said)
    nextus, the samurai warrior

Popular pages Recent additions subscribe to a feed