Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Extending C/C++ to include new "objects"

Extending C/C++ to include new "objects"

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++visual-studiooop
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CorvetteZ0606
    wrote on last edited by
    #1

    I have an idea for a new extention to C/C++. I'm not going to say exactly what it is, but it's similar to how a class is an extention of a struct. My question is, how was C extended to C++ to include the class keyword? It's not just a header file/library as far as I can tell. Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? I'm not trying to just create a new datatype. Thanks!

    C 1 Reply Last reply
    0
    • C CorvetteZ0606

      I have an idea for a new extention to C/C++. I'm not going to say exactly what it is, but it's similar to how a class is an extention of a struct. My question is, how was C extended to C++ to include the class keyword? It's not just a header file/library as far as I can tell. Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? I'm not trying to just create a new datatype. Thanks!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      CorvetteZ0606 wrote: how was C extended to C++ to include the class keyword? Initially, a pre compiler was written that turned C++ code into C, and it was passed to a C compiler from there. So classes would have been turned into structs. Now, the compilers are written to understand what a class is. CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Christian Graus - Microsoft MVP - C++

      C 1 Reply Last reply
      0
      • C Christian Graus

        CorvetteZ0606 wrote: how was C extended to C++ to include the class keyword? Initially, a pre compiler was written that turned C++ code into C, and it was passed to a C compiler from there. So classes would have been turned into structs. Now, the compilers are written to understand what a class is. CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Christian Graus - Microsoft MVP - C++

        C Offline
        C Offline
        CorvetteZ0606
        wrote on last edited by
        #3

        Christian Graus wrote: CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Well maybe there should be ;-)

        S 1 Reply Last reply
        0
        • C CorvetteZ0606

          Christian Graus wrote: CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Well maybe there should be ;-)

          S Offline
          S Offline
          Stuart Konen
          wrote on last edited by
          #4

          You could write your own precompiler and add it to the MSVC++ IDE via a pre-build step.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups