Roman numerals are a number system that was originated from ancient Rome. Even though it is sort of obsolete, we often come across Roman numerals in various places. They are often used in movie titles, monarch names, chemistry periodic tables, sporting events among others. Sometimes it is difficult to read, especially the big numbers, for … Continue reading “C++ | Roman to Decimal Conversion”
Category: C++
Execute User Defined Function before Main() in C++
In the previous article, we saw how to execute user defined function before main() in C. In C++ also we can use same mechanism to execute function before main. Here we’ll explore other options in C++. Execute Function before Main() By Creating Global Object Define a class. Call an user defined function from the class … Continue reading “Execute User Defined Function before Main() in C++”
Function Overloading in C++
Function overloading in C++ allows us having multiple definitions of a single function or method. That means that we can have multiple functions with same name. But their input arguments need to be different, either in data type or number of arguments. In time of calling the function, the compiler decides which function to call … Continue reading “Function Overloading in C++”
Singleton Class in C++
Singleton class ensures that there will be only one object of the class in lifetime of a program. Normally we can create as many objects as we want from a particular class. But you’ll be able to create at most one object from a singleton class. Where to Use Singleton Class? There are situations where … Continue reading “Singleton Class in C++”
What is std::shared_ptr? Examples
std::shared_ptr is a smart pointer that manages shared ownership of an object through pointer. Multiple std::shared_ptr (s) can hold the same object pointer. The actual object gets deleted when all the std::shared_ptr (s) go out of scope or get deleted/reset. It was introduced in C++11. It helps C++ programmers cleaning up memory in very convenient … Continue reading “What is std::shared_ptr? Examples”