- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34494 Articles for Programming
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
426 Views
Under Composition, if the parent object is deleted, then the child object also loses its status. The composition is a special type of Aggregation and gives a part-of relationship.For example, A Car has an engine. If the car is destroyed, the engine is destroyed as well.public class Engine { . . . } public class Car { Engine eng = new Engine(); ....... }Aggregation is a directional relation between objects in C#. It is the relationship between objects.For example, Employee and AddressAn Employee is associated with a single Department, whereas a Department can have more than one employee. Let ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
102 Views
Structure In C#, a structure is a value type data type. It helps you to make a single variable hold related data of various data types. The struct keyword is used for creating a structure. To define a structure, you must use the struct statement. The struct statement defines a new data type, with more than one member for your program. Classes When you define a class, you define a blueprint for a data type. A class definition starts with the keyword class followed by the class name, and the class body enclosed by a pair of curly braces. Structure ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
234 Views
When you define a class, you define a blueprint for a data type.Objects are instances of a class. The methods and variables that constitute a class are called members of the class.To access the class members, you use the dot (.) operator after the object name. The dot operator links the name of an object with the name of a member for example, Box Box1 = new Box();Above you can see Box1 is our object. We will use it to access the members −Box1.height = 7.0;You can also use it to call member functions −Box1.getVolume();The following is an example showing ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
2K+ Views
Runtime polymorphism has method overriding that is also known as dynamic binding or late binding. It is implemented by abstract classes and virtual functions.Abstract ClassesAbstract classes contain abstract methods, which are implemented by the derived class.Let us see an example of abstract classes that implements run time polymorphism −Example Live Demousing System; namespace PolymorphismApplication { abstract class Shape { public abstract int area(); } class Rectangle: Shape { private int length; private int width; public Rectangle( int a = 0, int b = 0) { ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
1K+ Views
If no access modifier is specified, then the default is Internal. Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly. In other words, any member with internal access specifier can be accessed from any class or method defined within the application in which the member is defined.The following is an example showing the usage of Internal access specifier −Example Live Demousing System; namespace RectangleApplication { class Rectangle { //member variables internal double length; internal double width; ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
500 Views
Static functions can access only static variables. The static functions exist even before the object is created.Set static functions as −public static int getNum() {}The following is an example demonstrating the use of static functions −Example Live Demousing System; namespace Demo { class StaticVar { public static int num; public void count() { num++; } public static int getNum() { return num; } } class StaticTester { static void Main(string[] args) { StaticVar s = new StaticVar(); s.count(); s.count(); s.count(); Console.WriteLine("Variable num: {0}", StaticVar.getNum()); Console.ReadKey(); } } }OutputVariable num: 3
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
4K+ Views
We can define class members as static using the static keyword. When we declare a member of a class as static, it means no matter how many objects of the class are created, there is only one copy of the static member.The keyword static implies that only one instance of the member exists for a class. Static variables are used for defining constants because their values can be retrieved by invoking the class without creating an instance of it. Static variables can be initialized outside the member function or class definition. You can also initialize static variables inside the class ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
167 Views
The Array class is the base class for all the arrays in C#. It is defined in the System namespace.The most commonly used methods of the array class are −Sr.No.Methods & Description1ClearSets a range of elements in the Array to zero, to false, or to null, depending on the element type2Copy(Array, Array, Int32)Copies a range of elements from an Array starting at the first element and pastes them into another Array starting at the first element. The length is specified as a 32-bit integer.3CopyTo(Array, Int32)Copies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
190 Views
A nested class is a class declared in another enclosing class. It is a member of its enclosing class and the members of an enclosing class have no access to members of a nested class.Let us see an example code snippet of nested classes in C# −class One { public int num1; public class Two { public int num2; } } class Demo { static void Main() { One a = new One(); a.num1++; One.Two ab = new One.Two(); ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
1K+ Views
Float , double and a decimal are all Value Types in C#. Value type variables can be assigned a value directly. They are derived from the class System.ValueType. The value types directly contain data. Float Value Type Float is a 32-bit single-precision floating point type with range 3.4 x 1038 to + 3.4 x 1038 Memory Size is 4 bytes. float a = 3.5f; Double Value Type Double is a 64-bit double-precision floating point type with range (+/-)5.0 x 10-324 to (+/-)1.7 x 10308 Memory Size is 8 bytes. double d = 5.78788 Decimal Value ... Read More