What is the Difference between Class and Struct?
Answers were Sorted based on User's Feedback
Answer / manju
The only difference between class and struct is that
in class all members are private by default whereas in
struct the members are by default public.
| Is This Answer Correct ? | 11 Yes | 0 No |
Answer / ashish srivastava
by default
struct elements are public
while
class elements are private
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / satvir kaur
STRUCTURE CLASS
1.structure by default is 1. class by default is private
public.
2.structure does not 2.class provide data hiding.
provide data hiding.
3.A structure would be the 3.class would be the collection
collection of related data. of data & code which handels
data.
CAN U TELL ME MORE DIFFERENCE BETWEEN LIKE THIS PLZ TELL ME
AS EARLY AS POSSIBLE I AM WAITING
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / wfwre
Class elements are accessed using the provided methods.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / vishnupriya
1.the variables of struct r jus varialbles inly,whereas it
it objects for class...
2. pointers can be used in structure only for same return
types,but in classes it can be uses for diff classes
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / purna
answer 3 is wrong.
answer 4 is absolutely corret.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / sureshreddy
the diff b/w structure and class is class by deafualt
private, where as structure by default public.
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / talib hassan
1.Structure cannot provide the re usability but class provide the re usability of code.
2. All the members of structure are public but a class provide the several types of accessing methods.
3. structure cannot support polymorphism concept but class provide polymorphism.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / revathy
no functions in structures
member functions are available in class
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / santhosh.r
Structs allocates continues memory
where as class does not
structs and functions are the basic idea behind class
| Is This Answer Correct ? | 0 Yes | 1 No |
What is the difference between the = symbol and == symbol?
cavium networks written test pattern ..
Is fortran still used in 2018?
What does 3 periods mean in texting?
How pointers are declared?
f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c?
How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
When can you use a pointer with a function?
Why pointers are used?
what is the different between if-else and switch statment (other than syntax)
26 Answers CTS, Oracle, Scorpos,
When is a “switch” statement preferable over an “if” statement?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above