Hi
I ger the error :"can not be applied for string and void". Any way to fix it?
auto.Horn() works, but i want it into Console.WriteLine.
Thanks
using System;
class Vehicle
{
public virtual void Horn()
{
Console.WriteLine("horn in general");
}
}
class Car : Vehicle
{
public override void Horn()
{
Console.WriteLine("horn of car does tuut!");
}
}
class Head
{
static void Main(string[] args)
{
Car auto = new Car();
Console.WriteLine("Horn does " + auto.Horn());
}
}
Sachin SinghPosted Jun 27, 2021, 7:09 AM
Sonil KumarPosted Jul 30, 2021, 12:50 PM
Valerie MeunierPosted Jun 27, 2021, 7:58 AM
Pranam BhatPosted Jun 27, 2021, 5:15 AM
Valerie MeunierPosted Jun 26, 2021, 9:17 PM
Pranam BhatPosted Jun 26, 2021, 4:49 PM
public class Car : Vehicle