C++ class help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ class help

Hello everyone I was wondering if you can help me out on some questions, What is a properly defined structure struct {int a}; struct a_struct {int a;} struct a_struct int a; struct a_struct {int a;}; another question is when a class is instantiated is a constructor method always executed? Or method and destructor is always executed and lastly can classes can be istantiated more than once.

2nd Dec 2020, 12:35 AM
boba
boba - avatar
4 Answers
+ 3
Every time when the class is instantiated the constructor is called.
2nd Dec 2020, 1:34 AM
Umesh Bagade
Umesh Bagade - avatar
+ 3
A class can be instantiated as many times as necessary. Except for a class designed with Singleton design. https://www.sololearn.com/learn/675/?ref=app
2nd Dec 2020, 3:38 AM
Ipang
+ 2
The properly defined structure is - struct a_struct{Int a;};
2nd Dec 2020, 1:33 AM
Umesh Bagade
Umesh Bagade - avatar
0
A class can be instantiated only once
2nd Dec 2020, 1:35 AM
Umesh Bagade
Umesh Bagade - avatar