Derived class issues with arrays and casting in C++

I’m working my way through C++ FAQs book by Cline and Lomow, and it’s excellent. There’s lots of issues going on with inheritance, arrays and casting that could be a real pain to deal with towards the end of system development, but that you can nip in the bud and make life easier for yourself. For example, just knowing that an array of objects of a Derived class is NOT a kind-of array of objects of the Base class can prevent you a lot of headaches…

Good to know – now I just have to keep it in mind when I’m coding!

How-To: Initialise arrays of objects in Java

You might think, like I did, that if you create an array of objects in Java then the constructor is automatically called on each object as part of the array creation process. But you’d be wrong.

Creating an array merely creates the object references – you have to instantiate each “inner” object in the array as a separate step if you want to be able to, ya know, do stuff… I think this is because in Java an array is an object – like, quite literally a single object that can be passed around like a single thing.

An example, perhaps?

Person Class

PersonTestDrive Class

An introduction to ActionScript 3.0 – week 4 lesson 1

I stopped organising the slides for web publication after week 3 lesson 2 (back in March 2010!) because I just wasn’t seeing any demand, and if no-one’s using them, there was no point in me working on ’em. Apparently at least one person has found the slides useful and asked about any further sets, so I’m happy to put ’em together if they’ll be used.

ActionScript Slides Week 4 Lesson 1

As you might have worked out from the title slide above, we’re covering variables, constants, arrays and loops and some push/pop stuff – all good, solid first steps to getting fun stuff done w/ AS3 =D

Download slides link: An Introduction to ActionScript 3.0 – Week 4, Lesson 1
Audience: Beginners who know a little about variables and how to perform some basic programming math.
Format: Powerpoint 2003 (so they can be opened in LibreOffice/OpenOffice, MS Office 2K3/2K7/2K10 etc.)
Template: OOo2 by Chih-Hao Tsai
Content License: These slides are released under a creative commons non-commercial attribution share-alike 3.0 license by me (r3dux), which means that you are encouraged to copy, distribute and modify the work, but must attribute the original author. Further, you may not use the work for commercial purposes, and any derivative works must be released under the same license. These slides come with no guarantee of correctness, fitness for purpose or anything of the sort. They are correct to the best of my knowledge, nothing more – nothing less. The work and any comments therein contain my own personal opinions and not those of my employer or anyone related to education in Australia in any way, shape or form. Issues, comments? Put something in the contact form in the top right or leave a comment on this article. Cheers!