How can you include two classes into one? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can you include two classes into one?

14th May 2017, 5:59 PM
Γιάννης Δημητριάδης
Γιάννης Δημητριάδης - avatar
4 Answers
+ 2
You could just use: #include "yourClass1.h" #include "yourClass2.h" and then create objects of them: YourClass1 class1 = new YourClass1(); YourClass2 class2 = new YourClass2(); like so, you can use both classes in another class. If your talking about inheriting two classes, well...you can only have one base class. cheers
14th May 2017, 6:04 PM
nouseforname
nouseforname - avatar
+ 3
are you talking about inheritance in classes
14th May 2017, 6:02 PM
MR Programmer
MR Programmer - avatar
+ 1
I'm not sure. What I mean is you have 2 classes with some functions and then you want to be included in another class. So when you call that class compiler executes the two included classes.
14th May 2017, 6:05 PM
Γιάννης Δημητριάδης
Γιάννης Δημητριάδης - avatar
+ 1
Ok thanks. I don't really need that for something. It was just a thought.
14th May 2017, 6:08 PM
Γιάννης Δημητριάδης
Γιάννης Δημητριάδης - avatar