Structs struct s when we put class c specifies all

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: orks here. works implicit – the compiler makes a copy of the the contents of an object into a new memory location of the same type of Applied Programming So TimeType t1, t2; t1.Set(10,20,30); t2 = t1; Applied Programming OK. It's time we said what the similarities between It's structs and classes are. structs struct S { .... When we put class C { specifies all things after the { are public specifies – unless the word private appears. unless private In essence structs and classes are the same!!! In structs anything after that is private, unless the keyword anything public appears. public For structs iit is the reverse. For structs t BUT, we usually use struct for those types with BUT, struct for all public data (and possibly functions). all Applied Programming Now back to copying. Since an assigment jjust copies the data for an Since assigment ust instance, no dynamic data is copied. This is called shallow copying. shallow Applied Programming Thus list2 would be the same linked list, but Thus list2 would woul...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online