Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

by Unknown user

In the previous installment I wrote a successful unit test that saved and loaded checkbox data. By way of refresher, here's that code:

...

First I assign the Persister object to the ManyToMany object. 

Then I set some links and very to the right-side records and verify that the ManyToMany object correctly maintains those links. 

...

Code Block
Load                                                procedure(long leftRecordID,CML_Data_ManyToManyLinksData linksData),virtual
Save                                                procedure(long leftRecordID,CML_Data_ManyToManyLinksData linksData),virtual

When the , virtual attribute is present on any table method in the class the compiler creates something called a virtual method table (VMT) for that class

If a derived class has a method with the same name and prototype as a virtual method in the parent class, and that method has the , virtual attribute, then any time the parent method is called the runtime library consults the VMT to see if there is a derived method that should be called instead

Virtual methods are one of the most powerful and compelling features of object-oriented programming. They allow you to selectively replace code in a parent class with your own code. Among other things, they are the mechanism by which most embed code is inserted into ABC applications

Derived virtual methods

...

Unit testing can be incredibly useful, but sometimes wiring unit-tested code into a working program reveals new issues that need to be addressed. I'll cover those next time.