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. Function prototype

Function prototype

Scheduled Pinned Locked Moved C / C++ / MFC
question
11 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.
  • H hph

    Hello, i have simple question, think of a common prototype like int FuncName(int var); now, what does it mean if i put a conclusive "=0" on it, like int FuncName(int var) = 0; Thanks in advance!

    P Offline
    P Offline
    Prakash Nadar
    wrote on last edited by
    #2

    it gave me this error error C2072: 'FuncName' : initialization of a function this is declaration of a pure function of a class. that means that the implementation of the method is not in this class and must be implemented in the derived class.


    I have lost more blood shaving than on the battlefield - Adolf Hitler

    H 1 Reply Last reply
    0
    • P Prakash Nadar

      it gave me this error error C2072: 'FuncName' : initialization of a function this is declaration of a pure function of a class. that means that the implementation of the method is not in this class and must be implemented in the derived class.


      I have lost more blood shaving than on the battlefield - Adolf Hitler

      H Offline
      H Offline
      hph
      wrote on last edited by
      #3

      Thanks, but .. let's think that it is already implemented in a derived class, i only want to know what i does!!

      P 1 Reply Last reply
      0
      • H hph

        Thanks, but .. let's think that it is already implemented in a derived class, i only want to know what i does!!

        P Offline
        P Offline
        Prakash Nadar
        wrote on last edited by
        #4

        Its a way to declare that the base class will not implement the function the derived class have to do it before they make object of the class. plus pure virtual functions in the base class means you cant make an object of the baseclass. There are lot of other concepts behind pure virtual functions, read some good book on it to be more clear. pure virtual functions are the foundations of COM


        I have lost more blood shaving than on the battlefield - Adolf Hitler

        H K 2 Replies Last reply
        0
        • P Prakash Nadar

          Its a way to declare that the base class will not implement the function the derived class have to do it before they make object of the class. plus pure virtual functions in the base class means you cant make an object of the baseclass. There are lot of other concepts behind pure virtual functions, read some good book on it to be more clear. pure virtual functions are the foundations of COM


          I have lost more blood shaving than on the battlefield - Adolf Hitler

          H Offline
          H Offline
          hph
          wrote on last edited by
          #5

          Thank you for your help! But, please delete your citation of Adolf Hitler, there's nothing good associated with Adolf Hitler! It my be funny if you tell the citation once, but it is absolutely wrong to use it as a footnote!

          P 1 Reply Last reply
          0
          • H hph

            Thank you for your help! But, please delete your citation of Adolf Hitler, there's nothing good associated with Adolf Hitler! It my be funny if you tell the citation once, but it is absolutely wrong to use it as a footnote!

            P Offline
            P Offline
            Prakash Nadar
            wrote on last edited by
            #6

            I agree he was worst living being ever walked on the earth, but you should agree with me that he was the Best leader ever walked on the earth to motivate his people, Dont worry i will remove it soon :-) I keep changing my sig every now n then.


            I have lost more blood shaving than on the battlefield - Adolf Hitler

            D 1 Reply Last reply
            0
            • P Prakash Nadar

              Its a way to declare that the base class will not implement the function the derived class have to do it before they make object of the class. plus pure virtual functions in the base class means you cant make an object of the baseclass. There are lot of other concepts behind pure virtual functions, read some good book on it to be more clear. pure virtual functions are the foundations of COM


              I have lost more blood shaving than on the battlefield - Adolf Hitler

              K Offline
              K Offline
              Kevin McFarlane
              wrote on last edited by
              #7

              Mr.Prakash wrote: Its a way to declare that the base class will not implement the function the derived class have to do it before they make object of the class. Though the base class can still provide an implementation that derived classes can use. Mr.Prakash wrote: pure virtual functions in the base class means you cant make an object of the baseclass. Correct. Kevin

              P 1 Reply Last reply
              0
              • K Kevin McFarlane

                Mr.Prakash wrote: Its a way to declare that the base class will not implement the function the derived class have to do it before they make object of the class. Though the base class can still provide an implementation that derived classes can use. Mr.Prakash wrote: pure virtual functions in the base class means you cant make an object of the baseclass. Correct. Kevin

                P Offline
                P Offline
                Prakash Nadar
                wrote on last edited by
                #8

                Kevin McFarlane wrote: Though the base class can still provide an implementation that derived classes can use. are you sure about pure virtual functions ?


                I have lost more blood shaving than on the battlefield - Adolf Hitler

                K 1 Reply Last reply
                0
                • P Prakash Nadar

                  I agree he was worst living being ever walked on the earth, but you should agree with me that he was the Best leader ever walked on the earth to motivate his people, Dont worry i will remove it soon :-) I keep changing my sig every now n then.


                  I have lost more blood shaving than on the battlefield - Adolf Hitler

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #9

                  Mr.Prakash wrote: ...you should agree with me that he was the Best leader ever walked on the earth to motivate his people, If you consider fear to be a motivator. A better leader uses love and compassion, never force. Hands down, the title of best-leader-ever-walked-on-the-earth-to-motivate-his-people goes to Christ Jesus.

                  P 1 Reply Last reply
                  0
                  • P Prakash Nadar

                    Kevin McFarlane wrote: Though the base class can still provide an implementation that derived classes can use. are you sure about pure virtual functions ?


                    I have lost more blood shaving than on the battlefield - Adolf Hitler

                    K Offline
                    K Offline
                    Kevin McFarlane
                    wrote on last edited by
                    #10

                    Mr.Prakash wrote: are you sure about pure virtual functions ? Yes. There's an example somewhere in Scott Meyers's Effective C++. I don't think a similar thing is possible in Java or C# though. Kevin

                    1 Reply Last reply
                    0
                    • D David Crow

                      Mr.Prakash wrote: ...you should agree with me that he was the Best leader ever walked on the earth to motivate his people, If you consider fear to be a motivator. A better leader uses love and compassion, never force. Hands down, the title of best-leader-ever-walked-on-the-earth-to-motivate-his-people goes to Christ Jesus.

                      P Offline
                      P Offline
                      Prakash Nadar
                      wrote on last edited by
                      #11

                      DavidCrow wrote: Hands down, the title of best-leader-ever-walked-on-the-earth-to-motivate-his-people goes to Christ Jesus. correct. Some ppl will say he never existed that depends on beliver and non beliver. ok about Hitler He alone cannot spread fear, He had loyal ppl to do that, and he motivated ppl to be loyal to him. Its well know that he could move ppl emotionally with his speech. Fear was for nor german ppl.


                      P.R.A.K.A.S.H

                      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