Given a Student class, and UndergradCourse is a true subtype of Course, there is one method called recommend in the Student class:  public class Student {     public Course recommend(Course pCourseID); } Please evaluate if EACH of the method in UndergradStudent class violates the Liskov Substitution Principle. public class UndergradStudent extends Student { 1. public Course recommend(UndergradCourse pCourseID); 2. public UndergradCourse recommend(Course pCourseID); 3. public UndergradCourse recommend(Object pCourseID); 4. public Course recommend(Course pCourseID) throw SomeCheckedException;

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Given a Student class, and UndergradCourse is a true subtype of Course, there is one method called recommend in the Student class: 

public class Student {

    public Course recommend(Course pCourseID);

}

Please evaluate if EACH of the method in UndergradStudent class violates the Liskov Substitution Principle.

public class UndergradStudent extends Student {

1. public Course recommend(UndergradCourse pCourseID);

2. public UndergradCourse recommend(Course pCourseID);

3. public UndergradCourse recommend(Object pCourseID);

4. public Course recommend(Course pCourseID) throw SomeCheckedException;

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,