LearnFrenzy
Sign in Take a free test

Classes and Objects · Classes and Objects MCQ · Question 15

Which class is an aggregate? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 15 Back to Exercise

Which type can be initialized as T t{1, 2}; without a constructor?

  • A struct T { int a; int b; }; Correct
  • B class T { int a; int b; };
  • C struct T { T(int); int a, b; };
  • D struct T { virtual void f(); int a, b; };
Correct Answer: Option A

An aggregate has public data, no user-declared constructors and no virtual functions. The class version has private members.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links