ЁЯУв Too many exams? DonтАЩt know which one suits you best? Book Your Free Expert ЁЯСЙ call Now!


    Question

    Which of the following is a valid C++

    constructor?
    A void ClassName() {} Correct Answer Incorrect Answer
    B ClassName() {} Correct Answer Incorrect Answer
    C ~ClassName() {} Correct Answer Incorrect Answer
    D Constructor() {} Correct Answer Incorrect Answer
    E new ClassName() {} Correct Answer Incorrect Answer

    Solution

    Constructors have the same name as the class, no return type, and can initialize objects.

    Practice Next
    More C Programming Questions
    ask-question