Type casting
in .NET programming , We can cast an object to any of its base class.
System.Object is derived by all of type, so they can cast into object.
Example:
class animal
{
//do something
}
class dog:animal
{
//do something
}
so, in the Main method, we could cast as:
animal an_animal=new dog()
//type casting to its base class
Box and boxing
Boxing is used to store value types in the
garbage-collected heap (it means be temporary operation). Boxing is an implicit conversion of a
value type to the type object (it means be on memory to heap)
or to any interface type implemented by this value type. Boxing a value
type allocates an object instance on the heap and copies the value into
the new object.
Unboxing
Unboxing is an explicit conversion from the type object to a value type or from an interface type to a value type that implements the interfac
This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
0 comments:
Post a Comment