+ 1
can a structure have member function in C++?? if yes than what is the difference in class and structure?
3 odpowiedzi
+ 2
in structure the data member are public so it can be unsafe for us
but in c++ there are private visibility mode available so the encapsulation concept will fulfil
+ 2
yes we can
- 1
in structure, members are public by default but we can make it as private