C#
  Home arrow C# arrow C# Simplified, part 4: Structures, Inherit...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

C# Simplified, part 4: Structures, Inheritance and Interfaces
By: Anand Narayanaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 18
    2005-05-24

    Table of Contents:
  • C# Simplified, part 4: Structures, Inheritance and Interfaces
  • Properties
  • Inheritance
  • Sealed classes
  • Abstract classes
  • Interfaces
  • Combining Interfaces

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    C# Simplified, part 4: Structures, Inheritance and Interfaces


    (Page 1 of 7 )

    In this article, the fourth in a series covering C#, you will learn about structures, inheritance, and interfaces, with the help of illustrative source code. If you ever wondered what C# uses instead of multiple inheritance, keep reading.

    About the C# Simplified Series

    C# Simplified covers each and every concept of the C# programming language in a concise manner. The articles in this series have been divided into several parts and will provide detailed explanations along with source codes and screenshots. This series has been specifically written for beginners and students with an aim to teach C# in a quickest possible time. Please send your comments to csharpsimplified@gmail.com

    If you are familiar with C++, you should be familiar with structures. Structures are value types, and are defined by using the struct keyword. You should create an object of the structure in order to access the variables inside them. In listing 4.1, a structure named EmpStruct is created with two variables. Inside the Main() method, an object of the structure is created, and the appropriate variables are called and printed.

    Listing 4.1

    using System;

    struct EmpStruct

    {

    public int age;

    public string id;

    }

    class StructDemo

    {

    public static void Main()

    {

    EmpStruct es;

    es.id = "100";

    es.age = 20;

    Console.WriteLine(es.age);

    Console.WriteLine(es.id);

    }

    }

    More C# Articles
    More By Anand Narayanaswamy


     

    C# ARTICLES

    - C# and XML
    - Pointers and Arrays in C#
    - C# 3.0 Extension Methods
    - Overloading Operators in C#
    - Iterators and Nullable Types
    - Patterns and Iterators in C#
    - C# Exceptions
    - Methods in C#
    - Delegates and Events in C#
    - Advanced C#
    - Working with Regular Expressions in C#
    - Sending Simple E-Mail in C#
    - Building C# Comparable Objects: IComparable ...
    - Color Transformation Applications in C# GDI+...
    - Performing Color Transformation Operations i...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT