CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    19

    Quick True/False Class Question

    Hi everyone!

    Just looking at a C++ test for revision.

    Several statements are provided regarding C++ classes and I am asked which one is true. I've narrowed it down to two answers:

    1 - Whether specified or not, all C++ classes implicilty inherit from class object.

    2 - A pointer to an object can only be used to access its class's private member functions if the pointer is in a member or friend function

    But am unsure which one is correct, my thoughts are:

    1 - I've never heard of this but I read that all .net classes inherit from system.object. I think this is only for VC++ though and so not correct.

    2 - Sounds correct to me... but am a little unclear with the wording of the question.


    Any thoughts anyone?

    Thanks!

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Quick True/False Class Question

    Quote Originally Posted by MisterEd View Post
    1 - I've never heard of this but I read that all .net classes inherit from system.object. I think this is only for VC++ though and so not correct.
    There is no ".net" in C++. C++ is a general purpose language who's rules come from the ANSI/ISO specification. There is no such thing as a ".net" C++. C++ is C++.

    The .NET architecture has a totally separate language that uses C++ as a base, called "Managed C++" . This is a superset of C++ and other non-C++ language additions. Do not be confused just because Visual C++ has "true" C++ and another language called "Managed C++" available to you. You should be answering the question as it pertains to true blue C++.
    Code:
    class foo
    {
    };
    To answer your first question: Do you see foo inheriting from any objects?

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Sep 2009
    Posts
    19

    Re: Quick True/False Class Question

    Hi,

    Thanks very much for the clarification, I thought it was something specific to .net but was unsure if there was something I was missing.

    cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured