Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

difference between class and struct

Class: 
1. Members of a class are private by default.
2. Base classes/structures of a class are private by default.
3. It is declared using the class keyword.
4. It support inheritance.
5. It is refference type
6. It can have NULL values
7.It may have all the types of constructors and destructors.

Structure:
1. Members of a structure are public by default. 
2. Base classes/structures of a structure are public by default.
3. It is declared using the struct keyword.
4. It does not support inheritance.
5. It is value type.
6. It cannot have NULL values.
7. It may have only parameterized constructor.
Comment

PREVIOUS NEXT
Code Example
Csharp :: rock paper scissors c# 
Csharp :: get text unity 
Csharp :: Convert array of strings to List<string 
Csharp :: get index c# 
Csharp :: array sort c# 
Csharp :: roman to int 
Csharp :: c# select first value from list 
Csharp :: c# round double 
Csharp :: max value data annotation c# 
Csharp :: Squares of a Sorted Array 
Csharp :: webclient timeout 
Csharp :: c# return task list 
Csharp :: all possible substrings of a string 
Csharp :: 2d list c# 
Csharp :: relaycommand 
Csharp :: json property c# 
Csharp :: split string c# 
Csharp :: postasjsonasync reference c# 
Csharp :: file to byte array 
Csharp :: an existing connection was forcibly closed by the remote host. .net core 
Csharp :: bundle.config in mvc is missing 
Csharp :: c# signalr console app client example 
Csharp :: while c# 
Csharp :: c# close form 
Csharp :: uri file path c# 
Csharp :: static c# 
Csharp :: how to load file from resources in c# 
Csharp :: deserialize json to dynamic object c# 
Csharp :: how to use yield in c# 
Csharp :: random string generator c# 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =