Skip to content

exam05 of 42 school + subject + tutorial + explanations

Notifications You must be signed in to change notification settings

vbachele/exam05

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EXAM 05 42 or how to use classes

Exercice 00

Test your program

// In your terminal write each command
	g++ main.cpp Warlock.cpp
	./a.out > result.txt
	diff result.txt displayExample.txt // If you see a difference there is a problem

Exercice 01

Useful link

  1. What is an abstract class Abstract class allows to create a generic class like ASpell or ATarget where other class will be derived

Errors i've made by practicing

  1. Forget the const when you have a function that takes string for example
ASpell::ASpell(std::string const Sname, std::string const Seffects) // don't forget the const
{
	this->name = Sname;
	this->effects = Seffects;
}
  1. Forget to return (*this) operator= for the coplien's
ATarget &ATarget::operator=(ATarget const &other)
{
	this->type = other.type;
	return (*this);
}
  1. I forgot #pragma once in my hpp files Allow to include your file only once during compilation. It generated a lot of mistakes

About

exam05 of 42 school + subject + tutorial + explanations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages