Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference between Class and Structure?

Answer Posted / uppu goutami

In C++, A structure can have both variable and functions as members.It can also declare some of its members as 'private' so that they cannot be accessed directly by the external functions.
In C++, The structure names are stand-alone and can be used like any other type names. That is, the keyword 'struct' can be omitted in the declaration of structure variable.
For example, We can declare the student variable.
For student A; // c++ declaration
This is an error in C.
C++ incorporates all these extensions in another user-defined type known as 'class'. There is very little syntactical difference between class and structure in C++ and, therefore, They can be used interchangeably with minor modifications. Since 'class' is a specially introduced data type, most of the C++ programmers tend to use the structures for holding only data, and classes to hold both the data and functions.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does ios :: app do in c++?

1027


Explain how a pointer to function can be declared in C++?

1058


Can circle be called an ellipse?

1075


what is Loop function? What are different types of Loops?

1229


Explain what is polymorphism in c++?

1127


What are c++ templates used for?

1134


What is data binding in c++?

956


What is the advantage of an external iterator.

1040


Is c++ the hardest language?

983


Is c# written in c++?

980


Explain the use of this pointer?

1156


What is the use of endl in c++ give an example?

1161


Can a program run without main in c++?

1203


How do you flush std cout?

1090


What is do..while loops structure?

1145