What is the difference between class and structure?

Answer Posted / mohan

By default the members of struct are public.
By default the members of class are priavte.

When an object is created to a class, constructor will be
called automatically.
But not in struct (if structure having member function with
structure name)

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write string class as your own class in java without using any built-in function

1981


Why is object oriented programming so hard?

616


Is react oop?

616


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1152


Which type does string inherit from?

618






How do you define social class?

605


Explain virtual inheritance?

688


What is abstraction example?

626


Why polymorphism is used in oops?

588


What is abstraction and encapsulation?

577


Write a program to reverse a string using recursive function?

1798


Who invented oop?

659


If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

944


What is super in oop?

601


What is encapsulation with example?

583