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 : What is Discrete simulation Discrete

    Discrete simulation: In a discrete simulation, the time passes at an irregular rate which is determined by the primary events of interest in simulation.

  • Q : What do you mean by ActiveX control

    What do you mean by ActiveX control? Describe in brief.

  • Q : Limit the Use of Pre-processor

    Limit the Use of Pre-processor Directives: The C pre-processor is powerful, but unrestricted use of it can lead to code that is hard to understand and analyze. Limit its use to inclusion of header files and simple macro definitions. Avoid features suc

  • Q : Explain One Dimensional array One

    One Dimensional array:1) An array is a continuous memory location having similar kind of data in a single row or single column. Declaration in c++ is as under: const int size = 20;int a[size] or int a[2

  • Q : Scripting Language Programming

    Hi Assignment Team, Please find attachment of my assignment. Please advise if there is any unclear information Regards, King

  • 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 : What is Hostname What is Hostname : It

    What is Hostname: It is the name of a host system.

  • Q : Role of ScriptManagerProxy control?

    Explain the role of ScriptManagerProxy control?

  • Q : Explain main quality of unsuitable life

    What are the main quality consequences of selecting an unsuitable life cycle model for a software project?

  • Q : Java program to sort ten numbers using

    Q. Write a java program to sort ten numbers using bubble sort method. Ans. class Bubble sort

    Discover Q & A

    Leading Solution Library
    Avail More Than 1428084 Solved problems, classrooms assignments, textbook's solutions, for quick Downloads
    No hassle, Instant Access
    Start Discovering

    18,76,764

    1947927
    Asked

    3,689

    Active Tutors

    1428084

    Questions
    Answered

    Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!

    Submit Assignment

    ©TutorsGlobe All rights reserved 2022-2023.