Giter VIP home page Giter VIP logo

cpp_04's Introduction

C++ Module 04 - Polymorphism, Abstract Classes, and Interfaces

Exercise 00: Polymorphism

Description

  • Create a base class called Animal with a protected attribute type.
  • Implement a Dog class and a Cat class that inherit from Animal. Set the type attribute based on the class name.
  • Each animal should have a makeSound() method that prints an appropriate sound.

Requirements

  • Implement the classes with specific constructors and destructors.
  • Implement tests to demonstrate polymorphism.

Exercise 01: I don’t want to set the world on fire

Description

  • Create a Brain class with an array of 100 std::string called ideas.
  • Dog and Cat should have a private Brain* attribute.
  • Upon construction, Dog and Cat should create their Brain using new Brain().
  • Upon destruction, Dog and Cat should delete their Brain.
  • Create an array of Animal objects (half Dog, half Cat) and delete them in the correct order. Check for memory leaks.

Requirements

  • Ensure deep copying of Dog and Cat.
  • Implement tests to check for memory leaks and deep copying.

Exercise 02: Abstract class

Description

  • Make the Animal class non-instantiable to prevent instantiation.
  • Fix the Animal class so it's not possible to create instances of it.

Requirements

  • Update the Animal class to be non-instantiable.

Exercise 03: Interface & Recap

Description

  • Implement an abstract class AMateria with necessary member functions.
  • Implement concrete classes Ice and Cure that inherit from AMateria.
  • Create a Character class with an inventory of AMateria objects.
  • Implement an interface ICharacter for the Character class.
  • Implement a MateriaSource class that can learn and create AMateria objects.

Requirements

  • Implement the classes with specific constructors, destructors, and member functions.
  • Ensure deep copying for the Character class.
  • Implement tests to demonstrate the functionality of the classes.

cpp_04's People

Contributors

emohamedd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.