Posts tagged as classes


C/C++ : Creating a Custom Class

There are two methods for creating a class in a C++ project. The first method is to code your class directly in the project code in which you will be using the class. However, if you take that route, you cannot reuse that code later (say, for an entirely different project) without opening the first project, copying the code, and pasting it into your new project. The second method involves creating a discrete class project, separate from any program code, and then "including" the class in your program code. I try to always use the second method, for the very simple fact that if I create a class I find useful, I can use it again and again.

OOP and C#: Making a Sample Class

Understanding the principles of OOP (object-oriented programming) is very important for those who wish to become .NET programmers, since the .NET Framework is built on the premise that everything is an Object. Since C# was created specifically to implement the .NET Framework, it stands to reason that C# is a good language to demonstrate the development of an object from a logical construct to a piece of working code. The code we will develop here can also be modified to work in pretty much any language that supports OOP. So, get your pencils and notepads ready, kids. It's time to build an object!

C# Sample: RandomDataSet Class

This is a class I had to code for a project to demonstrate a handful of sort and search algorithms. It is a self-contained class that can be used to build a List of integers. You could easily modify this class to manipulate pretty much any Collection.

C# Sample: Timing Class

This timing class can be used to test the execution time of your C# algorithms. We used it to compare the time it took various sort and search functions to complete execution.

A Discussion of Class

I seem to have to explain the concept of "classes" to a lot of programming students lately, so I got to thinking that a new blog post may be in order. So, if you happen to be a newbie programmer and are wondering exactly what a class is, tune in and follow along. Please ask questions at the end, too, if anything is not clear...