Got troubles with inheritance syntax. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Got troubles with inheritance syntax.

I can't derive the Daughter class from the Mother class. Need your help, guys. I've added two sepparate classes. BASE CLASS HEADER: #pragma once class Mother { public: Mother(); void sayHi(); ~Mother(); }; DERIVED CLASS HEADER: #pragma once class Daughter : public Mother //word Mother is undelined adn there is an error: "not a class or struct name" { public: Daughter(); ~Daughter(); }; What am I missing? Would appreciate any help.

25th Feb 2017, 4:35 PM
Arthur Fedotiev
Arthur Fedotiev - avatar
4 Answers
+ 6
I don't think there is an mistake in your question.
25th Feb 2017, 4:59 PM
Mr.Robot
Mr.Robot - avatar
+ 1
Do you have #include "mother.h" line in daughter header file, if you're using different files?
25th Feb 2017, 5:36 PM
Esmira
Esmira - avatar
+ 1
@Esmira Muslija, silly me. It was so obvious. Thank you helping me!
25th Feb 2017, 6:15 PM
Arthur Fedotiev
Arthur Fedotiev - avatar
0
You're welcome. :D
25th Feb 2017, 6:17 PM
Esmira
Esmira - avatar