--%>

How class and a structure are different

How class and a structure are different?

E

Expert

Verified

a.) Class:

  • The class is a reference type.
  • During instantiating the class, CLR assigns memory for its instance in heap.
  • Class supports inheritance.
  • Variables of the class could be allotted as null.
  • It can contain constructor or destructor.


b.) Structure:

  • The structure is a value type.
  • Memory is assigned on stack.
  • It does not support inheritance.
  • Members of Structure could not have null values.
  • It do not need constructor or destructor and members could be initialized automatically.

   Related Questions in Programming Languages

  • Q : Kernel Mode Illustrate what are the

    Illustrate what are the different functions of Kernel Mode, interrupts and system calls?

  • Q : Explain VeriSoft VeriSoft (Godefroid,

    VeriSoft (Godefroid, 2005) is a model checker for C and C++; other languages can be used, but components in other languages are treated as black boxes. VeriSoft has been used to find defects in very large telecommunications programs (Chandra, Godefroi

  • Q : Differentiate between RDO and ADO

    Differentiate between RDO and ADO?

  • Q : What is Round robin allocation Round

    Round robin allocation: It is an allocation of time slices which repeatedly cycles regarding a set of eligible threads in the fixed order.

  • Q : Calculating Tax on an Order in SQL

    Process the following steps to make a procedure to compute the tax on an order. The BB_TAX table includes the states which need taxes to be submitted for Internet sales. When the state is not listed in the table, then no tax must be accessed on any order. Shopper&rsqu

  • Q : Explain Base type Base type : The kind

    Base type: The kind of items that might be stored in an array - the arrays defined type. For example, in     int[] numbers; the base type

  • Q : What is Concurrency Concurrency : This

    Concurrency: This is a feature of parallel programming. The parts of a program whose executions overlap in time are stated to execute concurrently. Java's thread characteristic support concurrency.

  • Q : Inheritance in Object Oriented

    Q. What is the use of making a method private inside

  • Q : Explain Information hiding Information

    Information hiding: The practice of making sure that only as much information is exposed regarding the implementation of a class as is strictly needed. Hiding needless knowledge of implementation makes it not as much of likely that other classes will

  • Q : Top command Specify, what does the top

    Specify, what does the top command displays?