Reputation: 737
I have a base class Student
, and an inheriting class StudentAtA
.
I define StudentAtA
inside StudentAtA.h
, and it overides some of the methods of Student
.
For example, if Student
has:
string returnUni()
{
return NULL;
};
Then I define inside StudentAtA.h
an overriding method:
string returnUni()
{
return "A";
};
Since all the methods in StudentAtA
are short, they're all implemented in the header file (I didn't create a StudentAtA.cpp
file).
Now I have a Driver.cpp
file which uses StudentAtA
, and contains a main function. This is the executor.
Is it possible to compile Driver
without having StudentAtA.cpp
(just using the header)?
Upvotes: 1
Views: 58
Reputation: 4738
yes possible. Just make sure you include StudentAtA.h in your Driver.cpp
Upvotes: 3