Multiple choice technology programming languages

What is the problem,if any in the following code: struct Sample { int a; Sample() { a=0; } }; class Sample2:public Sample { }; struct Sample3:protected Sample2{};

  1. nothing wrong will complie fine.

  2. class cannot inherit from struct

  3. struct cannot inherit from class

  4. struct cannot have constructor

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The code compiles without errors. In C++, structs and classes can inherit from each other. They are nearly identical, differing only in default access (public for struct, private for class). Constructors are allowed in structs.