Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //In IAutomobile.cs file
- using System;
- namespace LearnInterfaces
- {
- interface IAutomobile
- {
- string LicensePlate { get; }
- double Speed { get; }
- int Wheels { get; }
- void Honk();
- }
- }
- ============================================================================================================================
- //In Sedan.cs
- using System;
- namespace LearnInterfaces
- {
- class Sedan : IAutomobile
- {
- //must include public keyword
- public string LicensePlate { get; }
- public double Speed { get; }
- public int Wheels { get; }
- //define the method
- public void Honk(){
- Console.WriteLine("HONK!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement