Grokking SOLID Design Principles
Ask Author
Back to course home

0% completed

Vote For New Content
Roman Strijac
Why can't we call reCharge method in first example?

Roman Strijac

Nov 15, 2024

public class ElectricCar : Car {

public override void refuel() {        

    reCharge()

}

private void reCharge() {

    Console.WriteLine("Car is recharging");

}

}

public class ElectricCar : Vehicle {

public override void refuel() {        

    recharge();

}   

private void recharge() {

    Console.WriteLine("Electric car is recharging");

}

}

2

0

Comments
Comments

On this page