What is the difference between structure and class-00750

Online Quiz This subjective question is related to the book/course vu cs502 Fundamentals of Algorithms. It can also be found in vu cs502 Mid Term Solved Past Paper No. 1.

Question 1: What is the difference between structure and class?
Answer:

The ONLY DIFFERENCES between classes and structures are

  1. classes DEFAULT to having private members. Structures DEFAULT to having public members. These defaults can be changed so classes can be made to work like structures and vice versa.
  2. classes DEFAULT to inheriting privately from base classes. Structures DEFAULT to inheriting public from base classes. These defaults can be changed so classes can be made to work like structures and vice versa.

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background