www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons C# Objects and Classes Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
Lesson 23
The concept of objects and classes is almost the same in C# as in Java. Object is the ultimate base class of all other types. New reference types can be defined using the 'class' and 'interface' declarations. Delegate is another reference type. It is like a functions pointer as in C and C++. Reference types actually hold the value of a memory address occupied by the object they reference.

We declare a class in the same way as we do in Java and C++. Consider the following piece of code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace helloworld
   class Program
//program code goes here....
Some Points to Remember:
  • using statement is used to import external code(namespaces), as we use the import keyword in Java.
  • The keyword namespace is just like the package keyword in Java.
  • Every class has to be a part of a namespace. The above class belongs to the namespace helloworld.
  • Unlike C++ there are no global functions or variables. Everything has to be the part of a class.
  • Unlike Java and C++ a class can be declared as partial, which means that the class is written in more than 1 .cs files.
We will continue our discussion on classes and objects in the next lesson.
Next >>> Lesson No. 15: C# Objects and Classes 2

Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.