What is the difference between Class and Structure?
Answer Posted / sundarchum
Structs are Value type. They are stored as a stack on
memory.
Class is reference type. They are stored as heap on memory.
Sturcts constructor must contain a parameter and cannot
have default constructor.
Class constructor may contain no parameter.
Struct cannot have instance field.
Class can have instance field.
Struct cannot inherit from a structure.
Class can inherit from a class.
Structs cannot declare a destructor.
Is This Answer Correct ? | 101 Yes | 49 No |
Post New Answer View All Answers
What does new do in c++?
Write a program in c++ to print the numbers from n to n2 except 5 and its multiples
Is c++ an integer?
How can you quickly find the number of elements stored in a static array?
What is the average salary of a c++ programmer?
State the difference between pre and post increment/decrement operations.
What should main() return in c and c++?
Define a conversion constructor?
How to give an alternate name to a namespace?
Write a program to find the Fibonacci series recursively.
What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack
Which field is used in c++?
What is a multiset c++?
Write a program to read the data and evaluate the results of the election. Print all output to the screen. Your output should specify: The total number of votes, the number of valid votes and the number of spoilt votes. The winner(s) of the election. Hint: An appropriate search should be used to determine the winner(s). The votes obtained by each candidate sorted in terms of the number of votes obtained. Hint: An appropriate sort should be used to sort the candidate(s). The Source code should be saved as VotingSystem. Project Input: Candidates’ Names and Numbers 2501 Victor Taylor 2502 Denise Duncan 2503 Kamal Ramdhan 2504 Michael Ali 2505 Anisa Sawh 2506 Carol Khan 2507 Gary Owen Votes 3 1 2 5 4 3 5 3 5 3 2 8 1 6 7 7 3 5 6 9 3 4 7 1 2 4 5 5 1 4 0 Project Output: Invalid vote: 8 Invalid vote: 9 Number of voters: 30 Number of valid votes: 28 Number of spoilt votes: 2 The winner(s): 2503 Kamal Ramdhan 2505 Anisa Sawh Candidate Score 2503 Kamal Ramdhan 6 2505 Anisa Sawh 6 2501 Victor Taylor 4 2504 Michael Ali 4 2502 Denise Duncan 3 2507 Gary Owen 3 2506 Carol Khan 2
Which of the following is evaluated first: a) && b) || c) !