This is a mirror of official site: http://jasper-net.blogspot.com/

Class and object references

| Thursday, March 4, 2010
Further to my previous post which introduced classes and objects as a way of storing unliked-typed variables I’ll now describe how to reference different objects and discriminate between different objects of the same class giving you the power to define, manipulate and disregard objects within your code.

Discriminating between objects

Using my previous Vehicle class.

Vehicle car1 = new Vehicle();
car1.sManufacturer = "BMW";
car1.sModel = "Five Series";

Vehicle car2 = new Vehicle();
car2.sManufacturer = "Ford";
car2.sModel = "Fiesta";

Creating an object car2 and assigning it the manufacturer “Ford” has no effect on the car1 object. The ability to discriminate between objects is the real power of the class construct. Objects can be created, manipulated and dispensed with in isolation from other objects of the same class.

Read more: rwilliamson.net

Posted via email from jasper22's posterous

0 comments: