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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Simple inheritance but a single error. plz run this !!

Simple inheritance but a single error. plz run this !!

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 5 Posters 1 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.
  • Z Offline
    Z Offline
    Zealous_Me
    wrote on last edited by
    #1

    # include "iostream.h" # include "conio.h" class baby { private: int weight,age; char name[20]; public : int standard; baby(int age, int weight, int standard):age(age),weight(weight),standard(standard) { } baby(int age, int weight):age(age),weight(weight) { } void get_name() { cout<<"\n \n Enter the name of the baby -> "; cin>>name; } void show_data() { cout<<"\n \n The name of the baby is -> "< "< "; cin>>mybaby_name; } void show_mybabyname() { cout<<"\n \n The name of my baby is -> "< "<

    P C C 3 Replies Last reply
    0
    • Z Zealous_Me

      # include "iostream.h" # include "conio.h" class baby { private: int weight,age; char name[20]; public : int standard; baby(int age, int weight, int standard):age(age),weight(weight),standard(standard) { } baby(int age, int weight):age(age),weight(weight) { } void get_name() { cout<<"\n \n Enter the name of the baby -> "; cin>>name; } void show_data() { cout<<"\n \n The name of the baby is -> "< "< "; cin>>mybaby_name; } void show_mybabyname() { cout<<"\n \n The name of my baby is -> "< "<

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      I hate, if somebody ask to run code for him, and guess what problem he/she might be facing. Its better to tell problem yourself.

      Prasad Notifier using ATL | Operator new[],delete[][^]

      1 Reply Last reply
      0
      • Z Zealous_Me

        # include "iostream.h" # include "conio.h" class baby { private: int weight,age; char name[20]; public : int standard; baby(int age, int weight, int standard):age(age),weight(weight),standard(standard) { } baby(int age, int weight):age(age),weight(weight) { } void get_name() { cout<<"\n \n Enter the name of the baby -> "; cin>>name; } void show_data() { cout<<"\n \n The name of the baby is -> "< "< "; cin>>mybaby_name; } void show_mybabyname() { cout<<"\n \n The name of my baby is -> "< "<

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        Read this[^]


        Cédric Moonen Software developer
        Charting control [v1.1]

        T 1 Reply Last reply
        0
        • Z Zealous_Me

          # include "iostream.h" # include "conio.h" class baby { private: int weight,age; char name[20]; public : int standard; baby(int age, int weight, int standard):age(age),weight(weight),standard(standard) { } baby(int age, int weight):age(age),weight(weight) { } void get_name() { cout<<"\n \n Enter the name of the baby -> "; cin>>name; } void show_data() { cout<<"\n \n The name of the baby is -> "< "< "; cin>>mybaby_name; } void show_mybabyname() { cout<<"\n \n The name of my baby is -> "< "<

          C Offline
          C Offline
          C Mahesh
          wrote on last edited by
          #4

          Since you have not described your problem, my gues on seeing your code is that you should have a default constructor in the baby class.

          Z 1 Reply Last reply
          0
          • C C Mahesh

            Since you have not described your problem, my gues on seeing your code is that you should have a default constructor in the baby class.

            Z Offline
            Z Offline
            Zealous_Me
            wrote on last edited by
            #5

            yes exactly ur guess is absolutely right. the error being issued is ->> cannot find default constructor to initialize base class 'baby' in function mybaby::mybaby(int,int). as i am new to inheritance technicalities can u plz tell me how to fix this issue and why did it came up ? ? plz !! Thank you.

            1 Reply Last reply
            0
            • C Cedric Moonen

              Read this[^]


              Cédric Moonen Software developer
              Charting control [v1.1]

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              Cedric Moonen wrote:

              ead this[^]

              long time no see man! where are you

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta Global Interface Table: An Easy Way to Marshal an Interface Pointer[new] VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

              C 1 Reply Last reply
              0
              • T ThatsAlok

                Cedric Moonen wrote:

                ead this[^]

                long time no see man! where are you

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta Global Interface Table: An Easy Way to Marshal an Interface Pointer[new] VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                C Offline
                C Offline
                Cedric Moonen
                wrote on last edited by
                #7

                Hi Alok ! I don't think it's been soo long :doh: But anyway, maybe I don't reply much because I have much more things to do (both in and out work). And what about you ?


                Cédric Moonen Software developer
                Charting control [v1.1]

                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