014-001-003

Inheritance Basics: Student Self-Introduction Program

Medium

Problem Description

Input Format:

  • Line 1: Class type (Person or Student)
  • Line 2: Name (string)
  • Line 3: Age (integer)
  • Line 4: Student ID (only for Student)

Output: Return value of introduce() method

In this problem, you will implement the introduce method in the Student class that returns a self-introduction string containing name, age, and student ID.

Explanation

1. Problem Background and Purpose

inheritance is one of the most important concepts in object-oriented programming. Through this problem with Person and Student classes, you'll learn the basic mechanism of inheritance. In real development, inheritance is used to efficiently design groups of classes that share common characteristics.

By understanding inheritance, you can avoid code duplication and write maintainable programs. This learning leads to understanding polymorphism and interfaces next.

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up