E
epanda
Hi,
I would like to merge two class which have got 90% of same source
code. But I don't know what to do.
class A {
int putLightOn () {
switch(status)
{
case iAmOff :
print "I am off" ;
print "put me on!!!\n" ;
}
}
}
class B {
int putLightOn () {
switch(status)
{
case iAmOff :
print "I am off" ;
print "and I am a red light" ; <<<< the only difference
between A and B
print "put me on!!!\n" ;
}
}
}
I would like that B inherit from A but I don't know how re writing B's
putLightOn function
Can you help me?
Thanks
I would like to merge two class which have got 90% of same source
code. But I don't know what to do.
class A {
int putLightOn () {
switch(status)
{
case iAmOff :
print "I am off" ;
print "put me on!!!\n" ;
}
}
}
class B {
int putLightOn () {
switch(status)
{
case iAmOff :
print "I am off" ;
print "and I am a red light" ; <<<< the only difference
between A and B
print "put me on!!!\n" ;
}
}
}
I would like that B inherit from A but I don't know how re writing B's
putLightOn function
Can you help me?
Thanks