+ 1
Using Inheritance in C++
Create two classes Teacher and MathsTeacher, where Teacher has one public member called CollegeName. The class MathsTeacher inherits publicly from Teacher and has members mainSubject and TeacherName. Write a C++ program that uses inheritance. (You may include constructor or setter method)
13 ответов
+ 1
1.) Use curly braces for class
2.) Use them also in the second class
3.) Don't forget the semicolon ; after variables.
4.) Why are you setting everything to void? Think about the structure again and what type of variables you need (int, double, char, string..)
I suggest you to go through the tutorial again.
+ 1
Inheritance in C++
https://code.sololearn.com/ctT1c10QUn9K/?ref=app
0
Show your efforts!
0
I already did!! And since I'm having problems doing so that's why am asking
0
Vincent Alulu can we have a look what you had done?
0
you can post your code into the playground section, and then copy-paste it's link here,
in case you don't know.
0
Okay give me a minute
0
#include <iostream>
using namespace std;
class Teacher(
public:
void collegeName()
);
class MathsTeacher: public Teacher
public:
void mainSubject
void TeacherName
int main() {
return 0;
}
0
Can anyone help me through the whole thing??
0
class Teacher {
public:
char* collegeName();
};
class MathsTeacher: public Teacher {
public:
char* mainSubject;
char* TeacherName;
};
int main() {
return 0;
}
0
Thanks Bebida Roja hope you can answer the other questions I posted too🙏🏿🙏🏿
Please!!
0
Just click on my account profile and you will see the last four questions I posted🙏🏿
- 1
Hey Bebida Roja
Please help me out with the other three questions too🙏🏿🙏🏿