package CHAPTER06;

//부모 클래스 (Base 클래스)
class Base1 {
	// 매개변수를 받는 생성자 정의
	Base1(String message) {
		System.out.println("Base 생성자 호출: " + message);
	}
}

//자식 클래스 (Derived 클래스), Base 클래스를 상속받음
class Derived1 extends Base1 {
	// 자식 클래스의 생성자
	Derived1() {
		super("안녕하세요!"); // 부모 클래스(Base)의 생성자를 명시적으로 호출
		System.out.println("Derived 생성자 호출");
	}
}

//실행 클래스 (main 메서드 포함)
public class C6_03_SuperConstructorExample {
	public static void main(String[] args) {
		// Derived 클래스의 객체 생성
		// Base 클래스의 생성자가 먼저 실행된 후, Derived 클래스의 생성자가 실행됨.
		Derived1 obj = new Derived1();
	}
}
