ECE 101 Lecture Notes - Lecture 11: Object Copying, Init

41 views2 pages

Document Summary

A deep copy will copy the value of the variable not just their handle. So, if you are creating a deep copy you are duplicating the variable. Copy copy the memory location handle number. Deep copy copies the content stored in the memory location and creating a duplicate. If you change l2, l1 will change as well. * repeat whatever in the list number of times indicated after the sign. L1 = [4] l1 is a pointer (it is an address (just a number) + it is the symbolic name of a memory location . It points towards some information which translate to a list with the integer value of four. L2 = l1 l2 is pointing towards the same thing l1 is pointing at. Def show(self): print(self. x,self. y) myobj1= myclass(0,0) myobj2= myclass(4,5) myobj3 = myobj1 myobj1. inc_x() myobj1. show() myobj2. show() myobj3. show() These are variables that you initiate before typing any method.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions