Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

8. Classes in the .NET Framework > Classes, Instances & Constructors

Classes, Instances & Constructors

A class definition is like a sewing pattern that provides the instructions for constructing a garment. When you use a class, you instantiate it (create an instance) by using the new keyword with something that looks like a method call. It looks like a method call because it is a method call, a call to a special kind of method called a CONSTRUCTOR.

image

Make a Note

image

Constructors are just a kind of method, and are created like them. But there are a few additional rules:

• Constructors must always have the name of the class itself.

• Constructors don’t specify a return type. (They always return an instance of the class.)



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint