What are the differences between a struct and a class in
C++?

Answer Posted / supriya

Memory is alloated on Stack using Structure whereas in class its heap , that is it wont be stored at an contagious memory location.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of main function in c++?

532


What is c++ try block?

587


Why c++ is better than c language?

567


Difference between overloading vs. Overriding

594


What is insertion sorting?

671






What is code reusability in c++?

673


What are the advantages of using friend classes?

631


Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?

1589


What are the types of container classes?

622


What are disadvantages of pointers?

568


How can you create a virtual copy constructor?

587


What is format for defining a structure?

596


What is runtime polymorphism in c++?

595


Which format specifier is used for printing a pointer value?

584


Why c++ is created?

578