Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint
Cover Image
Cover Image
Drag to reposition
Contributed Answers

Hiding of all overloaded methods in base class in C++

Answered 16h 10m ago, 0 Views

In C++, we can use the function overloading techniques. But if some base class has one method in overloaded form (different function signature with the same name), and the derived class redefines one of the function which is present inside the base, then all of the overloaded version of that function will be hidden from the derived class. Let us see one example to get the clear idea. , ,

Extending namespace and Unnamed namespace

Answered 16h 15m ago, 0 Views

Here we will see how we can extend some namespace, and how the unnamed or anonymous name space can be used. Sometimes we can define one namespace. Then we can write the namespace again with the same definition. If the first one has some member, and second one has some other members, then the namespace is extended. We can use all of the members from that namespace. , , The unnamed namespace .....

Private Destructor in C++

Answered 16h 24m ago, 0 Views

Here we will see what will be the case if the destructors are private in C++. Let us see some example codes to get the idea. This code has private destructor, but it will not generate any error because no object is created. , In this program, this will generate compilation error, as we are trying to create one object, but the compiler can notice that the destructor is not accessible. So it .....

Returning multiple values from a function using Tuple and Pair in C++

Answered 16h 36m ago, 0 Views

In C or C++, we cannot return more than one value from a function. To return multiple values, we have to provide output parameter with the function. Here we will see another approach to return multiple value from a function using tuple and pair STL in C++. The Tuple is an object capable to hold a collection of elements, where each element can be of different types. The pair can make a set o.....

Name Mangling and extern “C” in C++

Answered 16h 55m ago, 0 Views

In C++ we can use the function overloading feature. Using this feature, we can create functions with same name. The only difference is the type of the arguments, and the number of arguments. The return type is not considered here. Now the question comes how the C++ distinguishes overloaded functions in object code? In the object code, it changes the name by adding information about the argu.....

How to declare a global variable in C++

Answered 16h 59m ago, 0 Views

To declare global variables in C++, we can declare variables after starting the program. Not inside any function or block. If we want to declare some variables that will be stored in some different file, then we can create one file, and store some variable. For some external file sometimes we need to put the extern keyword with it. Also we have to include the external file with the actual p.....

What is difference between GCC and G++ Compilers?

Answered 17h 6m ago, 0 Views

We use gcc and g++ compilers in different times. Here we will see what are the differences between gcc and g++. The gcc is GNU C compiler, and g++ is GNU C++ compiler. The main differences are like below − gcc can compile *.c or *.cpp files as C and C++ respectivelyg++ can also compile *.c and *.cpp files, but take both as C++ fileIf we want to use g++ to link the object files, it aut.....

How to prevent class inheritance in C++

Answered 17h 11m ago, 0 Views

Here we will see how to prevent inheritance in C++. The concept of preventing the inheritance is known as final class. In Java or C#, we can use final classes. In C++ there are no such direct way. Here we will see how to simulate the final class in C++. Here we will create one extra class called MakeFinalClass (its default constructor is private). This function is used to solve our purpose......

Program for Christmas Tree in C

Answered 17h 18m ago, 0 Views

Here we will see one interesting problem. In this problem, we will see how to print Christmas tree randomly. So the tree will be flickering like Christmas tree lights. To print a Christmas tree, we will print pyramids of various sizes just one beneath another. For the decorative leaves a random character is printed from a given list of characters. The height and randomness is adjustable. He.....

Print numbers in sequence using thread synchronization

Answered 17h 26m ago, 0 Views

Here we will see how to print numbers in a correct sequence using different threads. Here we will create n number of threads, then synchronize them. The idea is, the first thread will print 1, then second thread will print 2 and so on. When one thread is trying to print, it will lock the resource, so no thread can use that portion. , ,

1 2 3 4 5 6 7 ... 38 Next
loader
Advertisements
Contribution

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.