Skip to Main Content
Building Applications and Components with Visual Basic .NET
book

Building Applications and Components with Visual Basic .NET

by Ted Pattison, Dr. Joe Hummel
October 2003
Intermediate to advanced content levelIntermediate to advanced
592 pages
13h 42m
English
Addison-Wesley Professional
Content preview from Building Applications and Components with Visual Basic .NET

Object Cloning

Structures and classes have some fundamental differences. One important difference is that structures support copy-on-assignment, whereas classes do not. Thus classes lack automatic support for making a copy of an object. You must decide whether you want to add explicit object cloning support on a class-by-class basis.

When you want to create a class that supports object cloning, you must provide a custom instance method that is responsible for producing a copy of the current object. By convention, this method should be named Clone and its containing class should explicitly implement the ICloneable interface to advertise the fact that its objects support cloning. Listing 10.6 shows an example of a class named Dog that supports ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Visual Basic® .NET Power Coding

Visual Basic® .NET Power Coding

Paul Kimmel
Visual Basic 2015 Unleashed

Visual Basic 2015 Unleashed

Alessandro Del Sole
Programming in the .NET Environment

Programming in the .NET Environment

Damien Watkins, Mark Hammond, Brad Abrams

Publisher Resources

ISBN: 0201734958Purchase book