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. Class Function?

Class Function?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
4 Posts 4 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.
  • L Offline
    L Offline
    Loli10
    wrote on last edited by
    #1

    Why is it required to place a scope resolution operator when writing code out for class functions, and why does it cause a syntax error? Loli10

    C R 2 Replies Last reply
    0
    • L Loli10

      Why is it required to place a scope resolution operator when writing code out for class functions, and why does it cause a syntax error? Loli10

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      it's necessary because that's how the compiler knows which class to attach the code to, so to speak. without it, you'd need to have unique names for every function in every class - which makes inheritance pretty much impossible. -c


      Civilization is the limitless multiplication of unnecessary necessities.    Mark Twain

      Smaller Animals Software

      1 Reply Last reply
      0
      • L Loli10

        Why is it required to place a scope resolution operator when writing code out for class functions, and why does it cause a syntax error? Loli10

        R Offline
        R Offline
        Ravi Bhavnani
        wrote on last edited by
        #3

        As Chris has already said, it lets the compiler associate a function's implementation with a class. My point is that you can separate a large class (i.e. one with many functions) into different files. Also (not recommended), the same .cpp file can contain functions of more than one class. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com

        L 1 Reply Last reply
        0
        • R Ravi Bhavnani

          As Chris has already said, it lets the compiler associate a function's implementation with a class. My point is that you can separate a large class (i.e. one with many functions) into different files. Also (not recommended), the same .cpp file can contain functions of more than one class. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Thanks!

          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