C# Intermediate: Classes, Interfaces and OOP
4.6 (4,749 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
24,171 students enrolled
Wishlisted Wishlist

Please confirm that you want to add C# Intermediate: Classes, Interfaces and OOP to your Wishlist.

Add to Wishlist

C# Intermediate: Classes, Interfaces and OOP

An in-depth, step-by-step guide to classes, interface and object-oriented programming, with many real-world examples.
Best Seller
4.6 (4,749 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
24,171 students enrolled
Created by Mosh Hamedani
Last updated 5/2017
Current price: $10 Original price: $150 Discount: 93% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 5.5 hours on-demand video
  • 3 Articles
  • 9 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Work with classes, constructors, fields, properties, methods and indexers
  • Use encapsulation to improve the robustness of the code and reduce the impact of change
  • Re-use code using inheritance and composition
  • Understand the problems with inheritance and how composition solves these problems
  • Change the behaviour of an application by extending its code, rather than changing it
  • Develop loosely-coupled, testable and extensible applications using interfaces
View Curriculum
  • Basic understanding of C# constructs: variables, type conversion, classes, conditionals and loops

Whether you want to use C# to build web apps, mobile apps, desktop apps or games, understanding C# classes, interfaces and principles of object-oriented programming is crucial.

This course is the second part of Mosh's best-selling C# series and is all about classes, interfaces and object-oriented programming. In essence, you'll learn:

  • How to work with classes, constructors, fields, properties, methods and indexers

  • How to use encapsulation to reduce the impact of change

  • How to improve the robustness of your code

  • How to re-use code using inheritance and composition

  • Why composition is better than inheritance

  • How to build extensible applications using polymorphism

  • How to develop loosely-coupled, extensible and testable applications using interfaces

There are lots of free tutorials and videos on YouTube. Why would you want to take this course?

The answer is simple: quality of teaching.

Mosh is a passionate software engineer with over 13 years of experience developing applications in C#. He is the author of several best-selling C# courses on Udemy and knows how to lead you through a series of baby steps in a logical way.

So, from the very beginning to the very end, you'll be confident that you'll be in good hands and watching every minute of the course, unlike the reading many free tutorials and videos, does not waste your precious time.

Each section is equipped with a balanced mix of theory and practice. At the end of each section you'll get exercises to master the concepts you learn in that section.

And one last reason: all videos are produced with high quality video/audio, to provide you the best learning experience.


This course is the second part of Mosh's complete C# series on Udemy:

  • Part 1: C# Basics for Beginners: Learn C# Fundamentals by Coding 
  • Part 2: C# Intermediate: Classes, Interfaces and Object-oriented Programming
  • Part 3: C# Advanced: Take Your C# Skills to the Next Level


"I’ve actually landed my first job as a Junior software developer. I owe a lot of it to you because your courses have been EXTREMELY helpful. May God bless you and your efforts to create high quality courses. This has really changed my life from working as a security guard and doing websites for free, now I am a professional." -Danish Jafri

"Your courses have given me the confidence to get out of my dead end job and apply for a full time coding job. I am very happy to say that I just finished the job interview and they gave me the job!!!" -Dan Farnell

"Outstanding quality! I have come to learn that all Mosh's courses are top notch. This course is no different! The content is beautifully designed, well organized with great examples, and delivered in a clear and concise manner (with great video and audio quality)! I also loved that this course includes exercises. Fantastic stuff!" -Roger Sæle

"Love it! This guy definitely knows what he's talking about. He strives to make his courses as comprehensive as possible and he teaches you several tricks along the way." -Jeb Watson

"As with all of his courses his passion and love for programming is infectious. He does a great job of intermixing theory with hard examples and cautions with practicality. If you learn better by watching and examples then reading and theory this is a must watch to move beyond the learning the syntax of c#." -Michael Paul

"Excellent course! All of Mosh's courses are very much worth taking if you really want to learn C# in a professional way. Not only does Mosh clearly describe the syntax of the language and explain the language concepts, but he also constantly emphasizes the importance of good programming practices" -Tony Zampini


Mosh (Moshfegh) Hamedani is a passionate software engineer and teacher with 13 years of experience building applications using C# (since the first release of .NET Framework in 2002). Mosh is a full-time developer and what you are going to learn in this course is the result of his day-to-day work as a hardcore programmer along with years of studying,

Mosh's students describe him as a passionate teacher who knows how to take a student on a series of logical steps and enriching them with a great mixed of theory and practice.


This course comes with a 30-day full money-back guarantee. Take the course, go through the lectures, do the exercises, and if you're not happy, ask for a refund within 30 days. All your money back, no questions asked.

So do you want to take your C# skills to the next level? Then take this course now and get started!

Who is the target audience?
  • Any C# developer who wants to master classes and interfaces
  • Any C# programmer who wants to better understand object-oriented programming
Compare to Other Object Oriented Programming Courses
Curriculum For This Course
44 Lectures
About this Course
5 Lectures 07:56

Source Codes


Asking Questions
10 Lectures 01:49:07

  • What are classes and why we need them
  • What is the difference between a class and object
  • How to create classes, fields and methods
  • The var keyword
  • Static members
Introduction to Classes


  • How to quickly initialize objects without a constructor
Object Initializers

  • What is method signature
  • What is method overloading
  • Method parameter modifiers: params, out and ref
  • Why ref is a smell in the design of C# and why you should avoid it.
  • Defensive programming and how it improves the robustness of your applications.

  • Two ways to initialize fields (directly and via constructor) and the pros and cons of each
  • The readonly modifier and how it improves the robustness of your code


  • Public and Private access modifiers
  • What is encapsulation?
  • Why we should declare fields as private and provider public accessors
Access Modifiers

  • What are properties and how to create them
  • A quick way to create a property

  • What are indexers, how they are useful and how to create them
  • The Dictionary type


7 pages

2 pages
Association between Classes
5 Lectures 27:54
  • What is class coupling
  • What are tightly coupled and loosely coupled applications like
  • Three ways to reduce coupling
Preview 03:45

  • What is inheritance
  • An example of inheritance in a real-world scenario: building an application like Power Point
  • How to represent inheritance using UML
  • How to re-use code using inheritance
Preview 07:54

  • What is composition
  • An example of composition in a real-world scenario: DbMigrator and Logger
  • How to represent composition using UML
  • How to create a composition relationship between classes in C#

  • Why inheritance can easily be abused by amateur designers / developers
  • Problems with inheritance hierarchies
  • Why inheritance results in tight coupling between classes
  • How composition provides a more flexible and loosely coupled design
Favour Composition over Inheritance

2 pages
Inheritance - Second Pillar of OOP
6 Lectures 57:13
  • Why access modifiers are important and how they help writing better code
  • Examples of public, private, protected, internal and protected internal
  • Why protected breaks encapsulation and it's better to be avoided
Access Modifiers

  • Rules about constructors in inheritance hierarchies
  • The base keyword and how we can use that to pass control to base class constructors
Constructors and Inheritance

  • What is upcasting and down casting
  • Rules about casting an object to a base or derived class reference
  • The as and is keywords
  • StreamReader and ArrayList classes
Upcasting and Downcasting

  • What are value types and reference types
  • What is boxing and unboxing
  • Why boxing and unboxing comes with a performance penalty
  • Why generic lists are better to use than ArrayList
Boxing and Unboxing

3 pages

3 pages
Polymorphism: Third Pillar of OOP
5 Lectures 31:51
  • What is polymorphism and how we can achieve it by method overriding
  • The virtual and override keywords
  • How to get rid of long switch/case or if/else statements and re-write them in an object-oriented way with polymorphism

Method Overriding

  • What are abstract classes and members
  • The abstract and override keywords
  • Rules about abstract classes and inheriting from them
  • When to use abstract classes
Abstract Classes and Members

  • What are sealed classes and members
  • The sealed modifier
Sealed Classes and Members

3 pages

3 pages
7 Lectures 01:04:15
What is an Interface?

  • Introduction to Unit Testing with MS Tests framework
  • How interfaces improve the testability of your applications
Interfaces and Testability

I'll show you how we can change an application's behaviour without changing its code, simply by using interfaces as extensibility points. I'll also introduce you to the open-closed principle of object-oriented programming.

Preview 18:15

One of the common misconceptions about interfaces is that they are used for implementing multiple inheritance. This view is fundamentally wrong yet there are many books, videos and posts that make such claim. In this video I'll explain why interfaces got nothing to do with inheritance, single or multiple.

Interfaces are NOT for Multiple Inheritance

Interfaces provide polymorphic behaviour, which is extremely powerful. In this video, you'll see how we can use an interfaces in a polymorphic way to design a loosely-coupled and extensible application.

Interfaces and Polymorphism

3 pages

2 pages
What's Next?
3 Lectures 03:37
Final Words

My Other Courses

Get My Other Courses with a Discount
Bonus: Students' Code Reviews
3 Lectures 32:21
StopWatch Exercise

Stack Exercise

Workflow Engine Exercise
About the Instructor
Mosh Hamedani
4.6 Average rating
47,786 Reviews
139,161 Students
16 Courses
Passionate Software Engineer and Best-selling Author

Mosh (Moshfegh) Hamedani is a passionate and creative software engineer with a strong focus on pragmatism and simplicity. He started programming at the age of seven on a Commodore 64. Later, during his high school years, he started learning C and C++ . In 2002, along with the first release of .NET, he shifted his focus to C#. Since then, he has been involved in the design and implementation of numerous software projects, including modern web applications, mobile apps, desktop applications and frameworks.

He started teaching on Udemy in 2014 and currently he has over 100,000 students in 182 countries. He's the author of several best-selling courses on Udemy and #1 ranking course on Pluralsight (Become a Full-stack .NET Developer). 

Mosh has a Master of Science in Network Systems and a Bachelor of Science in Software Engineering. He is also a Microsoft Certified Application Developer, Technology Specialist (Web Applications) and Professional.

Outside the software world, Mosh is a photographer, a pianist and a passionate Latin dancer.