Skip to content
the poor coder

Home / Topics / #classes

#Classes

9 posts
2020

Hackerrank Virtual Functions Solution

This problem is to get you familiar with virtual functions. Create three classes Person, Professor and Student. The class Person should have data members name and age. The classes Professor and Student should inherit…

2020

Hackerrank Exceptional Server Solution

Your friend set up a small computational server that performs complex calculations. It has a function that takes large numbers as its input and returns a numeric result. Unfortunately, there are various exceptions that…

2020

Hackerrank Inherited Code Solution

You inherited a piece of code that performs username validation for your company's website. The existing function works reasonably well, but it throws an exception when the username is too short. Upon review, you…

2020

Hackerrank Box It! Solution

Design a class named Box whose dimensions are integers and private to the class. The dimensions are labelled: length , breadth , and height . The default constructor of the class should initialize , , and to . The…

2020

Hackerrank Classes and Objects Solution

A class defines a blueprint for an object. We use the same syntax to declare objects of a class as we use to declare variables of other basic types. For example: Kristen is a contender for valedictorian of her high…

2020

Hackerrank Class Solution

Classes in C++ are user defined types declared with keyword class that has data and functions . Although classes and structures have the same type of functionality, there are some basic differences. The data members of…

2020

Hackerrank Structs Solution

struct is a way to combine multiple fields to represent a composite data structure, which further lays the foundation for Object Oriented Programming. For example, we can store details related to a student in a struct…

ESC