Hardware Verification with C++: A Practitioner's Handbook

Chapter 11: OOP Classes

Experience is a dear teacher, but fools will learn at no other.

Benjamin Franklin

Highlights

Coming up with the appropriate classes for your project is an experi-ence-based effort. In other words, the authors made many mistakes in the beginning. To help you in designing classes, we have collected experience from our previous efforts.

So do what the authors did when they learned C++: find examples, copy, and paste!

This chapter introduces the thought process for creating classes, to answer questions such as these:

  • How do I determine what is a class, and what is a method?

  • How should I handle global functionality?

  • What can inheritance do for me?

  • What can operator overloading do for me?

  • What does the C++ compiler create automatically?

Overview

Classes are fundamental to writing in an object-oriented language. But how do we decide what is a class? We have talked about thinking in terms of layers of abstractions. We have talked about roles and responsibilities. The next thing is to start to name the classes and their responsibilities. This is not as hard as it sounds. For one thing, you make classes as you feel they should be, and there is no right or wrong way. Let each class do what feels right to you. There will, of course, be some spirited team discussions. This is the topic of the first section of this chapter.

Once you decide on some classes, you can wire up instances of classes pretty much like you create and wire up ...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Audio Amplifiers and Preamplifiers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.