O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Lesson 8
Learn C#. Series of C# lessons
http://csharp.honcharuk.me/lesson-8
Agenda
• Sealed
• Abstract classes
• Interfaces
• Abstract Class versus Interface
Sealed
• Sealed modifier prevents other classes from inheriting from it
sealed class A
{
}
//Gives an error, due to sealed...
Abstract classes
• Abstract class cannot be instantiated, and is frequently either partially
implemented, or not at all im...
Interfaces
• An interface is not a class.
• An interface is defined as a syntactical contract that all the classes
inherit...
Abstract Class versus Interface
Feature Interface Abstract class
Multiple inheritance YES NO
Default implementation NO YES...
Thank you!
Questions?
Próximos SlideShares
Carregando em…5
×

de

Lesson8 Slide 1 Lesson8 Slide 2 Lesson8 Slide 3 Lesson8 Slide 4 Lesson8 Slide 5 Lesson8 Slide 6 Lesson8 Slide 7
Próximos SlideShares
Skrillex
Avançar
Transfira para ler offline e ver em ecrã inteiro.

0 gostaram

Compartilhar

Baixar para ler offline

Lesson8

Baixar para ler offline

Learn C#

  • Seja a primeira pessoa a gostar disto

Lesson8

  1. 1. Lesson 8 Learn C#. Series of C# lessons http://csharp.honcharuk.me/lesson-8
  2. 2. Agenda • Sealed • Abstract classes • Interfaces • Abstract Class versus Interface
  3. 3. Sealed • Sealed modifier prevents other classes from inheriting from it sealed class A { } //Gives an error, due to sealed class A class B : A { }
  4. 4. Abstract classes • Abstract class cannot be instantiated, and is frequently either partially implemented, or not at all implemented public abstract class Country { public string Name { get; set; } public string Currency { get; set; } public void PrintInformation() { Console.WriteLine(Name); Console.WriteLine(Currency); Console.WriteLine(this.GetFlagDescription()); } public abstract string GetFlagDescription(); }
  5. 5. Interfaces • An interface is not a class. • An interface is defined as a syntactical contract that all the classes inheriting the interface should follow. public interface IAlcohol { double AlcoholByVolume { get; set; } double GetMaximumAllowedWightForHuman(); }
  6. 6. Abstract Class versus Interface Feature Interface Abstract class Multiple inheritance YES NO Default implementation NO YES Access Modfiers NO (Everything goes public by default) YES Fields and Constants NO YES
  7. 7. Thank you! Questions?

Learn C#

Vistos

Vistos totais

164

No Slideshare

0

De incorporações

0

Número de incorporações

107

Ações

Baixados

8

Compartilhados

0

Comentários

0

Curtir

0

×