I have two classes, each with its constructor. But when inheriting it stops compiling. What is the mistake? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have two classes, each with its constructor. But when inheriting it stops compiling. What is the mistake?

https://code.sololearn.com/c700d6E5VwfL/?ref=app

17th Dec 2021, 8:41 AM
Master Forts 🇦🇷
Master Forts 🇦🇷 - avatar
10 Answers
0
this is how it is implemented (Así se implementa) https://code.sololearn.com/c05M1howhY89/?ref=app
26th Jul 2022, 6:57 AM
Master Forts 🇦🇷
Master Forts 🇦🇷 - avatar
+ 2
How are you inheriting the classes ? Are you taking into consideration the fact that as you are using parameterised constructors, the compiler will not create a default constructor for you so when creating a derived class object, it need to explicitly pass correct arguments to it's parent class's constructor ?
17th Dec 2021, 9:01 AM
Arsenic
Arsenic - avatar
+ 1
Master Forts 🇦🇷 as mentioned before The compiler is complaining about not being able to find Patient::Patient () because there isn't any constructor with such signatures in your entire program. The closes one is "Paciente(string apellido, string nombres, string documento, string obraSocial )"for which you need to provide the arguments explicitly.
17th Dec 2021, 9:49 AM
Arsenic
Arsenic - avatar
0
without inheritance both constructors work fine, the error is: no matching function for call Patient :: Patient (). The implement struct Query: public Patient {… ..} Between struct and classes only privacy changes
17th Dec 2021, 9:28 AM
Master Forts 🇦🇷
Master Forts 🇦🇷 - avatar
0
only inheritance changes. The builders used to work fine. I don't see how to fix it
17th Dec 2021, 9:58 AM
Master Forts 🇦🇷
Master Forts 🇦🇷 - avatar
0
In C ++ struct and class are practically the same, with the only difference that in a struct the default members are public and in a default class they are private. A struct can contain the same as a class, methods, constructors, destructors, inheritance. There is a second difference between the use of struct and class and it is in the case of template: class can be used to declare types for a template, while struct cannot:
18th Dec 2021, 11:20 AM
Master Forts 🇦🇷
Master Forts 🇦🇷 - avatar
0
Can u told cooding app for Android please
18th Dec 2021, 4:46 PM
kamal shahi
kamal shahi - avatar
0
in your playstore filter c ++
18th Dec 2021, 6:31 PM
Master Forts 🇦🇷
Master Forts 🇦🇷 - avatar
0
Debía poner explicit en los constructores
30th Mar 2022, 12:44 AM
Master Forts 🇦🇷
Master Forts 🇦🇷 - avatar