title: Can C++ struct have member functions?
body: <p>I was pretty confused about the difference between struct and class as I seemed to see them used for pretty much the same things. I googled the differences and the only answer I saw was that structs have public members by default and classes have private members by default. However, my lecturers have just told me that structs cannot contain member functions. But I have seen many threads on the internet where people include member functions in structs and specifically say that it is alright to do so.</p>
  
  <p>My lecturers seem adamant that structs by definition cannot have functions, so what is going on? The only thing I could think of is that maybe the compiler changes functions within a struct to something else so that they technically don't contain functions... Is there a clear answer to these contradictions?</p>