0

What is use of class in C++

why we use class in C++

15th Dec 2016, 3:48 PM
Priyanshu
Priyanshu - avatar
2 Answers
+ 1
Hey priyanshu and other , In the world of object - oriented programming , we often want our types to not only hold data, provide function that work with the data as well. in c++ , this is typically done via the class keyword. using the class keyword defines a new user defined type called a class in c++, classes are very Much like data only struct, except classes provided much powerful and flexibility. in fact, the following struct and class are effectively identical: struct Data { int year ; int month; int day; }; class Data { public: int m_year; int m_month; int m_day; }; The only significant difference is Access specifier such as public protect private
15th Dec 2016, 4:08 PM
Mock
Mock - avatar
0
thanks
16th Dec 2016, 5:26 AM
Priyanshu
Priyanshu - avatar