S
stephen
Hi all,
I have an interface
interface ICar
{
void accelerate(double amt);
void brake(double amt);
double getSpeed();
}
and I create an abstract class
public abstract class GenericCar : ICar
{
protected double _speed;
public abstract void accelerate(double amt);
sealed override public void brake( double amt )
{
if( ( _speed - amt ) < 0.0 )
{
_speed = 0.0;
return;
}
_speed -= amt;
}
sealed override public getSpeed()
{
return _speed;
}
}
Class TestCar : GenericCar
{
//I want to have implementation for accelerate only
//and want to control brake and getSpeed from abstract class
}
I read on MSDN that If I have sealed override then I can access the abstract
classes methods
but it gives me an error "No Suitable method to override"
Please advice,
Stephen
I have an interface
interface ICar
{
void accelerate(double amt);
void brake(double amt);
double getSpeed();
}
and I create an abstract class
public abstract class GenericCar : ICar
{
protected double _speed;
public abstract void accelerate(double amt);
sealed override public void brake( double amt )
{
if( ( _speed - amt ) < 0.0 )
{
_speed = 0.0;
return;
}
_speed -= amt;
}
sealed override public getSpeed()
{
return _speed;
}
}
Class TestCar : GenericCar
{
//I want to have implementation for accelerate only
//and want to control brake and getSpeed from abstract class
}
I read on MSDN that If I have sealed override then I can access the abstract
classes methods
but it gives me an error "No Suitable method to override"
Please advice,
Stephen