Thread: C++ question

  1. #1
    Registered User datainjector's Avatar
    Join Date
    Mar 2002
    Posts
    356

    C++ question

    Hi, well i have just started learning C++ .And the book i am using is Thinking in C++ and teach youself C++ in 21 days ...The books dont have many questions to practice on.......These are the areas i am completed

    1) Classes
    @) operator/function overloading
    3) inheretance
    4) virtual functions and polymorphism .

    Plzz can u guys like type some of the question that you have in your books?

    Thanks alot ..
    "I wish i could wish my wishs away"

    "By indirections find directions out" -- William Shakespears

    "Do what thou wilt shall be the whole of the law" -- Crowley "THE BEAST 666"

    Mizra -> love = Death...
    RDB(Rocks yooo)..

    http://www.cbeginnersunited.com

    Are you ready for the Trix ???

  2. #2
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511

    Smile

    OK, here are some:

    Code:
    Which of the following creates an Animal object named dog?
                A.  Animal “dog”;	C.  dog “Animal”;
         B.  Animal dog;	D.  dog Animal;	
    
    
    The main difference between a pure virtual function and a regular virtual function is _______.
    A.  the return type
    B.  the inheritance properties
    C.  a pure virtual function cannot have an implementation.
    D.  the location in the class
    
    Select the format for inheriting multiple classes.
    A.  class Derived: public class Base1 : public class Base2
    B.  class Derived: public class Base1, Base2
    C.  class Derived: public Base1, public Base2
    D.  class Derived: (public Base1; public Base2;)
    
    Which statement about operator overloading is false?
    A.   New operators can never be created.
    B.   Certain overloaded operators can change the number of arguments they take.
    C.   The precedence of an operator cannot be changed by overloading.
    D.   Overloading cannot change how an operator works on built-in types.
    Have fun!!!
    Mr. C: Author and Instructor

  3. #3
    Terrancee
    Guest
    OOP is a tough subject to learn on your own. My opinion is to learn java first, then move onto c++. Or better yet, take some c++ classes.

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    >> My opinion is to learn java first

    Where's my shotgun?

  5. #5
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    it may not be the greatest, but it's certainly easier than C++, which can be good for noooooooobz
    hello, internet!

  6. #6
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    >> ...which can be good for noooooooobz

    More like the opposite! The sudden introduction of classes could easily confuse the complete noobie.

  7. #7
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Originally posted by Mister C
    The main difference between a pure virtual function and a regular virtual function is _______.
    A. the return type
    B. the inheritance properties
    C. a pure virtual function cannot have an implementation.
    D. the location in the class
    None of the above (I assume you wanted C). See pure virtual destructors.
    Last edited by Polymorphic OOP; 12-20-2002 at 07:24 AM.

  8. #8
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by face_master
    >> ...which can be good for noooooooobz

    More like the opposite! The sudden introduction of classes could easily confuse the complete noobie.
    but it is easier than C++
    hello, internet!

  9. #9
    Registered User
    Join Date
    Dec 2002
    Posts
    103

    w.r.t. difference between pure virtual functions and virtual functions

    Originally posted by moi
    it may not be the greatest, but it's certainly easier than C++, which can be good for noooooooobz
    As far as the question goes, I believe, choice "C" fits the bill.... so why bring in virtual distructors into the picture??

    If you got a point, why not be a bit explicit about it...
    Have a wonderful day.... and keep smiling... you look terrific that way
    signing off...
    shiv... as i know him

  10. #10
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Because pure virtual destructors must have a definition/implementation, so "C" isn't really correct.

  11. #11
    Registered User
    Join Date
    Dec 2002
    Posts
    103

    You are one hell of a C++ Freak

    Originally posted by Polymorphic OOP
    Because pure virtual destructors must have a definition/implementation, so "C" isn't really correct.
    I have no clue what noooobie learnt... I surely did

  12. #12
    Registered User datainjector's Avatar
    Join Date
    Mar 2002
    Posts
    356
    hey guys thanks for replying when i say 10 replies i was so happy butt , well there aint any question execpt the one mister C gave and those are to easy , i need questions like write a code type question ..Plzz just take a some time and post a question from ur book .Thanks
    "I wish i could wish my wishs away"

    "By indirections find directions out" -- William Shakespears

    "Do what thou wilt shall be the whole of the law" -- Crowley "THE BEAST 666"

    Mizra -> love = Death...
    RDB(Rocks yooo)..

    http://www.cbeginnersunited.com

    Are you ready for the Trix ???

  13. #13
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by Polymorphic OOP
    Because pure virtual destructors must have a definition/implementation, so "C" isn't really correct.
    That's great to know, but the question is about pure virtual functions.

  14. #14
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Originally posted by Eibro
    That's great to know, but the question is about pure virtual functions.
    The answer that was apparently suggested was that pure virtual functions can't have an implementation. A destructor is a function and a pure virtual desctructor needs implementation. I provided it as a counter-example. Explain again why this didn't pertain to the thread.

  15. #15
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by Polymorphic OOP
    The answer that was apparently suggested was that pure virtual functions can't have an implementation. A destructor is a function and a pure virtual desctructor needs implementation. I provided it as a counter-example. Explain again why this didn't pertain to the thread.
    What data type does a destructor return?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM