RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: Beginner
Aug 21, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Classes and Structs -- What's the Difference?

The keywords struct and class are almost interchangeable in C++. You can declare a struct that has member functions, constructors, destructor, base classes and so on as if it were a class. Likewise, it's possible to create a class that has only public data members. The only difference between a struct and a class is in the default access. By default, all the members of a struct are public whereas in a class, al the members are private. The same is true for the default inheritance type: a struct entails public inheritance by default whereas a class entails private inheritance. The struct keyword struct exists for the sake of backward compatibility with C.
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date