Advertisement
Guest User

C# OOP Crash Course

a guest
Nov 9th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. /**
  2.  * Written by Sam-Mauris Yong http://mauris.sg/
  3.  * Public Domain
  4.  */
  5.  
  6. namespace Sample {
  7.  
  8.     class Example {
  9.    
  10.         public int Count { get; set; }
  11.    
  12.         public Example() { // constructor
  13.            
  14.         }
  15.        
  16.         public Example(int count){ // overloaded constructor with different argument list
  17.             Count = count; // makes the this.Count to be the count parameter
  18.         }
  19.        
  20.         public void example(){ // this is a class method, not constructor
  21.            
  22.         }
  23.        
  24.         public void Example(){ // method, but same as class name - so invalid
  25.        
  26.         }
  27.    
  28.  
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement