Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Which type of polymorphism is used, if any, by main ( ) ? void PrintInfo ( string name ) { cout < < Player info:

Which type of polymorphism is used, if any, by main()?
void PrintInfo(string name){
cout << "Player info: "<< name << endl;
}
void PrintInfo(Player player){
cout << "Player info: "<< player.GetDetails()<< endl;
}
void PrintInfo(Forward* forwardPtr){
cout << "Player info: "<< forwardPtr->GetDetails()<< endl;
}
int main(){
vector soccerTeam;
Player* playerPtr;
Forward* forwardPtr;
soccerTeam.push_back(playerPtr);
soccerTeam.push_back(forwardPtr);
for (int i =0; i < soccerTeam.size(); ++i){
PrintInfo(soccerTeam.at(i));
}
}
Group of answer choices
Runtime
No polymorphism
Compile-time
Virtual

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions