Ray Tracer  2020
Protected Member Functions | Private Member Functions | List of all members
NonCopyable Class Reference

NonCopyable class. More...

#include <NonCopyable.h>

Inheritance diagram for NonCopyable:
ImageDisplay Scene SceneReader

Protected Member Functions

 NonCopyable ()
 NonCopyable default constructor. More...
 
 ~NonCopyable ()
 NonCopyable destructor. More...
 

Private Member Functions

 NonCopyable (const NonCopyable &)
 NonCopyable copy constructor. More...
 
NonCopyableoperator= (const NonCopyable &)
 NonCopyable assignment operator. More...
 

Detailed Description

NonCopyable class.

Sometimes it doesn't make sense for an object to be duplicated. This may be for technical reasons (such as the class representing a limited physical resoruce), and sometimes for practical reasons (such as the class storing lots of information). In C++ this can be enforced by explicitly deleting the copy constructor and assignment operator, or by making them private. The NonCopyable class makes this easy and less error prone to do. To make a class NonCopyable, just inherit (privately) from NonCopyable:

class MyClassCannotBeCopied: private NonCopyable {
...
};
NonCopyable class.
Definition: NonCopyable.h:27

Constructor & Destructor Documentation

◆ NonCopyable() [1/2]

NonCopyable::NonCopyable ( )
inlineprotected

NonCopyable default constructor.

◆ ~NonCopyable()

NonCopyable::~NonCopyable ( )
inlineprotected

NonCopyable destructor.

◆ NonCopyable() [2/2]

NonCopyable::NonCopyable ( const NonCopyable )
private

NonCopyable copy constructor.

Note that there is no implementation for the copy constructor. You cannot copy construct NonCopyable objects.

Member Function Documentation

◆ operator=()

NonCopyable& NonCopyable::operator= ( const NonCopyable )
private

NonCopyable assignment operator.

Note that there is no implementation for the assignment operator. You cannot assign NonCopyable objects.

Returns
Nothing - you cannot assign NonCopyable objects.

The documentation for this class was generated from the following file: