As per my knowledge, if the function is defined in the parent class, then you can't use the same function name with different parameter in child class without overriding the parent class function.
If you want to use then you have to either override the method defined in the parent class, or you need to put the declaration of new function definition in parent class.
ex:
class A
{
public:
size_t computeAverageRating(Movie m) { // take a movie object
// compute average rating
}
};
class B:public A
{
public:
size_t computeAverageRating(Movie m) //this is required
{
A::computeAverageRating(m);
}
size_t computeAverageRating(size_t movieIndex)
{
getMovieObject(movieIndex);
//put your logic here
}
};
or
class A
{
public:
size_t computeAverageRating(Movie m) { // take a movie object
// compute average rating
}
virtual size_t computeAverageRating(size_t movieIndex){};
};
class B:public A
{
public:
size_t computeAverageRating(size_t movieIndex)
{
getMovieObject(movieIndex);
//put your logic here
}
};