use strict;

package Medium;

sub new {
	my $classname = shift;
	my $self = {
		signatur => shift,
		autor    => shift,
		titel    => shift,
	};
	bless $self,$classname;
	return $self;
}

sub format {
	my $self = shift;
	return "$self->{signatur},$self->{autor},$self->{titel},M,0,0";
}

package CD;

sub new {
	my $classname = shift;
	my $self = Medium::new($classname, shift, shift, shift);
	$self->{spieldauer} = shift;
	return $self;
}

sub format {
	my $self = shift;
	return "$self->{signatur},$self->{autor},$self->{titel},C,0,$self->{spieldauer}";
}

package Buch;

sub new {
	my $classname = shift;
	my $self = Medium::new($classname, shift, shift, shift);
	$self->{seitenzahl} = shift;
	return $self;
}

sub format {
	my $self = shift;
	return "$self->{signatur},$self->{autor},$self->{titel},B,$self->{seitenzahl},0";
}

1;
	