What is the difference between Class and Structure?

Answer Posted / vandana mishra

Class is much broader,real world applicable 1-1-1: concept whereas structure is a primitive concept with poor internal organisation.
2: structure contains only data while class bind both data & member functions.
3: class provide data hiding,inheritance etc but structure didn't.
4: if we not define constructor in class there constructor automaticly invoke but in structure it does not happen automaticly.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define upcasting.

594


What is the use of default constructor?

578


What is the use of typedef?

640


If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?

673


What is the difference between interpreters and compilers?

640






Write a code/algo to find the frequency of each element in an array?

611


Explain the different access specifiers for the class member in c++.

552


A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.

3417


Why would you use pointers in c++?

634


Tell me what are static member functions?

618


What is functions syntax in c++?

627


Is c the same as c++?

570


What is the exit function in c++?

546


How do you remove an element from a set in c++?

587


What's the most powerful programming language?

604