Thread: Question of test c++

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    4

    Question of test c++

    is somebody now, which answer is ok. ?

    thank yuo for help

    Which of the following special methods can be created implicitly by C++ compiler inside a class (let’s say A)?


    a. the operator: const A& operator()(const A&);


    b. the operator: void operator~(const A*);

    c. the assignment operator: A& operator=(const A&);

    d. the constructor: A(const A*);

  2. #2
    Banned
    Join Date
    Nov 2007
    Posts
    678
    i wish i could tell that they are a and c
    but that would be wrongo
    tell us your guess?

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Sorry, you can't offload your exams on us.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    4
    CornedBee, do you valid answer??
    It's not may exam. I want to know it.
    I have problem with this question.

    best regarts,
    endrzer

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You could explain what you think and why. We can help to correct your understanding if it's incorrect.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Jan 2008
    Posts
    4
    i think it's
    c) the assignment operator: A& operator=(const A&);
    but i'm not sure..

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Yes, that is correct.
    Code:
    class A { };
    
    void Help()
    {
    	A a, b, c;
    	a = b = c;
    }
    This code obviously works but wouldn't if the compiler didn't automatically generate that operator by default.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    Jan 2008
    Posts
    4
    Thank you very much Elysia
    best regarts,
    endrzer

  9. #9
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Next time you might try writing a small test program. Write a class that doesn't overload any of these operators and see which ones the compiler lets you call.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about binary trees and files
    By satory in forum C Programming
    Replies: 9
    Last Post: 03-06-2006, 06:28 AM
  2. Why is my program freezing?
    By ShadowMetis in forum Windows Programming
    Replies: 8
    Last Post: 08-20-2004, 03:20 PM
  3. Question About Linker Errors In Dev-C++
    By ShadowMetis in forum C++ Programming
    Replies: 9
    Last Post: 08-18-2004, 08:42 PM
  4. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 05:10 AM
  5. test scores
    By ucme_me in forum C Programming
    Replies: 4
    Last Post: 11-14-2001, 01:48 PM