[email protected] Logout } Now we want to create a Cricket class that inherits the Sports class. We can override the get_name method and return a different string as. String get_name() { return "Cricket Class"; } Note that to override a method, the parameters and return type of the new method should be exactly the same as the old method. Your task is to write a program by writing an overridden getNumberOfTeam Members method that prints the same statement as the superclass' getNumberOfTeam Members method, except that it replaces with (the number of players on a cricket team). When executed, your completed code should print the following: Generic Sports Each team has n players in Generic Sports Cricket Class Each team has 11 players in Cricket Class
Home Jump to n Anywhere [email protected] Logout } Now we want to create a Cricket class that inherits the Sports class. We can override the get_name method and return a different string as. String get_name() { return "Cricket Class"; } Note that to override a method, the parameters and return type of the new method should be exactly the same as the old method. Your task is to write a program by writing an overridden getNumberOfTeam Members method that prints the same statement as the superclass' getNumberOfTeam Members method, except that it replaces with (the number of players on a cricket team). When executed, your completed code should print the following: Generic Sports Each team has n players in Generic Sports Cricket Class Each team has 11 players in Cricket Class
Home Jump to n Anywhere Home Jump to n Anywhere [email protected] Logout } Now we want to create a Cricket class that inher
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am