Assignment of Visual Programming: Question No. 1
Assignment of Visual Programming: Question No. 1
Question No. 1
Match the correct option from 2nd column and write in 3rd column.
Question No. 2
What is operator overloading and also difference between over loadable and non over loadable
operators?
Solution:
Operator Overloading:
You can redefine or overload most of the built-in operators available in C#. Thus a programmer
can use operators with user-defined types as well. Overloaded operators are functions with special
names the keyword operator followed by the symbol for the operator being defined. similar to
any other function, an overloaded operator has a return type and a parameter list.
For example:
In the above example function implements the addition operator (+) for a user-defined class Box.
It adds the attributes of two Box objects and returns the resultant Box object.
An overloaded declaration is a declaration that is declared with the same name as a previously
declared declaration in the same scope, except that both declarations have different arguments and
obviously different definition (implementation).
Question No. 3
What is collections in C# and also define Various Collection Classes and Their Usage?
Solution:
Collection of C#:
Collection classes are specialized classes for data storage and retrieval. These classes provide
support for stacks, queues, lists, and hash tables. Most collection classes implement the same
interfaces. Collection classes serve various purposes, such as allocating memory dynamically to
elements and accessing a list of items on the basis of an index etc. These classes create collections
of objects of the Object class, which is the base class for all data types in C#.