welcome to object oriented programming, i'll be your substitute teacher, mr. fry.
in the first case, you're not providing a default constructor for the base class. i think some compilers may create one for you, others are more specific and require that you make one.
classes that extend others will always call the constructor of their parent. so in your first example, there's basically an invisible line inside meow(int sss, int b) that calls "super()", which runs the code inside the rawr() initializer.
huh?
so this code:
Code:
void setup() {
new meow(45, 68);
}
class rawr
{
rawr()
{
println("rawr");
}
}
class meow extends rawr
{
meow(int sss,int b)
{
println("meow!");
}
}
will print
Code:rawr
meow!
is that what you expected?
the constructor of the superclass is always called in a subclass.
the code in your problematic example basically says that the only way to create a class of type 'rawr' is to pass it an int to get it started. because you're not doing that, it's giving you an error. this helps you enforce things like a case where the base class *must* have a particular variable initialized.
in order to fix things, and tell the compiler that you know what you're doing, you need to call super() yourself:
Code:
void setup() {
new meow(45, 68);
}
class rawr
{
rawr(int k)
{
println("rawr");
}
}
class meow extends rawr
{
meow(int sss,int b)
{
super(4);
println("meow!");
}
}
by passing 4 to the superclass, everything is ducky, and class is done for the day.