Skip to content

Class example::Animal

ClassList > example > Animal

Base class for all animals from which Bird derives.More...

  • #include <animal.h>

Inherits the following classes: example::AnimalInterface

Inherited by the following classes: example::Bird

Classes

Type Name
struct Result
Some random inner class of Animal .

Public Types

Type Name
typedef std::pair< Animal *, Animal * > Parents
enum Type
The 6 classes of animal kingdom.

Public Functions

Type Name
Animal (Type type, const std::string & name, Animal * mother=nullptr, Animal * father=nullptr)
The main constructor.
Animal (const Animal & other) = delete
Animal (Animal && animal) noexcept
const std::string & get_name () const
Get the name of the animal.
virtual int get_num_of_eyes () override const
Returns the number of eyes.
virtual int get_num_of_limbs () override const
Returns the number of limbs.
Parents get_parents () const
virtual bool has_tail () override const
Returns true if the animal has a tail.
virtual void make_sound () = 0
virtual void move ()
operator bool () const
Returns true if this is an valid animal.
Animal & operator= (const Animal & other) = delete
Deleted copy operator.
Animal & operator= (Animal && other) noexcept
Move operator.
void some_inline_member_function (Animal * animal)
Lorem Ipsum.
void swap (Animal & other) noexcept
virtual ~Animal () = default

Public Functions inherited from example::AnimalInterface

See example::AnimalInterface

Type Name
virtual int get_num_of_eyes () const = 0
Returns the number of eyes.
virtual int get_num_of_limbs () const = 0
Returns the number of limbs.
virtual bool has_tail () const = 0
Returns true if the animal has a tail.

Public Static Functions

Type Name
Animal * find_child_by_name (Animal * parent)
Animal * find_parent_by_name (Animal * child)

Protected Attributes

Type Name
Animal * father
The pointer to the father.
Animal * mother
The pointer to the mother.
std::string name

Detailed Description

Lorem Ipsum Donor. Some Random link with bold and italics And the following is a typewritter font.

Example code:

Animal animal = Animal("Hello World", nullptr, nullptr); std::cout << animal.get_name() << std::endl;

See also: Bird

Bug

Some random bug

Note:

Some random note

Warning:

Some random warning

Test

Some random test description

Todo

Some random todo

Template parameters:

  • T Some random template paramater description which actually does not exist in the code!

Precondition:

First initialize the system.

Date:

2017-2018

Author:

Matus Novak

Author:

Hello World

Public Types Documentation

typedef Parents

typedef std::pair<Animal*, Animal*> example::Animal::Parents;

enum Type

The 6 classes of animal kingdom.

enum example::Animal::Type {
    NONE = 0,
    INSECT = 1,
    AMPHIBIAN = 2,
    BIRD = 3,
    FISH = 4,
    REPTILE = 5,
    MAMMAL = 6
};

Lorem Ipsum Donor.

Public Functions Documentation

function Animal [1/3]

The main constructor.

example::Animal::Animal (
    Type type,
    const std::string & name,
    Animal * mother=nullptr,
    Animal * father=nullptr
) 

Use this constructor to allocate a new instance of Animal

Parameters:

  • type The type of the animal that matches Animal::Type
  • name Any name to associate the animal with

Exception:

function Animal [2/3]

example::Animal::Animal (
    const Animal & other
) = delete

function Animal [3/3]

example::Animal::Animal (
    Animal && animal
) noexcept

function get_name

Get the name of the animal.

inline const std::string & example::Animal::get_name () const

Returns:

A constant reference to the name

function get_num_of_eyes

Returns the number of eyes.

virtual int example::Animal::get_num_of_eyes () override const

See also: get_num_of_limbs, get_num_of_eyes

Implements example::AnimalInterface::get_num_of_eyes

function get_num_of_limbs

Returns the number of limbs.

virtual int example::Animal::get_num_of_limbs () override const

See also: get_num_of_eyes, get_num_of_limbs

Implements example::AnimalInterface::get_num_of_limbs

function get_parents

inline Parents example::Animal::get_parents () const

function has_tail

Returns true if the animal has a tail.

virtual bool example::Animal::has_tail () override const

See also: get_num_of_limbs, get_num_of_eyes

Return value:

  • true Does have a tail
  • false Does not have a tail

Implements example::AnimalInterface::has_tail

function make_sound

virtual void example::Animal::make_sound () = 0

function move

virtual void example::Animal::move () 

function operator bool

Returns true if this is an valid animal.

example::Animal::operator bool () const

Lorem Ipsum returns true

function operator=

Animal & example::Animal::operator= (
    const Animal & other
) = delete

function operator=

Animal & example::Animal::operator= (
    Animal && other
) noexcept

function some_inline_member_function

Lorem Ipsum.

inline void example::Animal::some_inline_member_function (
    Animal * animal
) 

See also: Animal

Parameters:

  • animal The pointer to the animal instance

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Implementation:

function swap

void example::Animal::swap (
    Animal & other
) noexcept

function ~Animal

virtual example::Animal::~Animal () = default

Public Static Functions Documentation

function find_child_by_name

static Animal * example::Animal::find_child_by_name (
    Animal * parent
) 

function find_parent_by_name

static Animal * example::Animal::find_parent_by_name (
    Animal * child
) 

Protected Attributes Documentation

variable father

The pointer to the father.

Animal* example::Animal::father;

Can be null!

variable mother

The pointer to the mother.

Animal* example::Animal::mother;

Can be null!

variable name

std::string example::Animal::name;

Friends Documentation

friend some_global_function

Some random global function that modifies Animal .

void example::Animal::some_global_function (
    Animal * animal
) 

See also: Animal

Parameters:

  • animal The pointer to the animal instance

The documentation for this class was generated from the following file demo-projets/animal/animal.h