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

Inheritance and friendship in C++

Smita Kapse
Answered 13h 55m ago

In C++, the friendship is not inherited. It means that, if one parent class has some friend functions, then the child class will not get them as friend.In this example it will generate an error because the display() function is friend of MyBaseClass but not the friend of MyDerivedClass. The ... Read More

Extending namespace and Unnamed namespace

Nishtha Thakur
Answered 13h 59m ago

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 ... Read More

Can main() be overloaded in C++?

Smita Kapse
Answered 14h 2m ago

In C++, we can use the function overloading. Now the question comes in our mind, that, can we overload the main() function also?Let us see one program to get the idea.Example#include <iostream> using namespace std; int main(int x) {    cout << "Value of x: " << x << "\n"; ... Read More

Function overloading and const keyword in C++

Anvi Jain
Answered 14h 5m ago

In C++, we can overload functions. Some functions are normal functions; some are constant type functions. Let us see one program and its output to get the idea about the constant functions and normal functions.Example#include <iostream> using namespace std; class my_class {    public:       void my_func() const ... Read More

Private Destructor in C++

Nishtha Thakur
Answered 14h 8m ago

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.Example#include <iostream> using namespace std; class my_class {   ... Read More

Use of explicit keyword in C++

Smita Kapse
Answered 14h 14m ago

Here we will see what will be the effect of explicit keyword in C++. Before discussing that, let us see one example code, and try to find out its output.Example#include <iostream> using namespace std; class Point {    private:       double x, y;    public:       ... Read More

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

Nishtha Thakur
Answered 14h 20m ago

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 ... Read More

static keyword in C++ vs Java

Smita Kapse
Answered 14h 25m ago

In C++ or Java we can get the static keyword. They are mostly same, but there are some basic differences between these two languages. Let us see the differences between static in C++ and static in Java.The static data members are basically same in Java and C++. The static data ... Read More

Multi-access Channels and Random Access Channels

Vikyath Ram
Answered 14h 28m ago

Multi-access ChannelsMulti-access channels are network channels that allow several transmitters to communicate with a common receiver via a shared channel. These channels are also called multiple access (MAC) channels. The network channel may be a single cable or optical fiber connecting multiple nodes, or a portion of the wireless spectrum.Random ... Read More

Inheritance in C++ vs Java

Anvi Jain
Answered 14h 37m ago

In C++ and Java, there are the concept of Inheritance. The inheritance properties are used to reuse the code and also make a relationship between two objects. Here we will see some basic differences between inheritance in C++ and inheritance in Java.In Java, all of the classes are extending the ... Read More

Name Mangling and extern “C” in C++

Nishtha Thakur
Answered 14h 39m ago

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 ... Read More

What is the C++ equivalent of sprintf?

Smita Kapse
Answered 14h 41m ago

The sprint() function is present inside the C and C++ also. This function is used to store something inside a string. The syntax is like the printf() function, the only difference is, we have to specify the string into it.In C++ also, we can do the same by using ostringstream. ... Read More

Compiling multiple .cpp files in c++ program

Anvi Jain
Answered 14h 42m ago

Here we will see how to compile multiple cpp file in C++ program. The task is very simple. We can provide the names as a list to the g++ compiler to compile them into one executable fileTo compile multiple files like abc.cpp, and xyz.cpp at once, the syntax will be ... Read More

How to declare a global variable in C++

Nishtha Thakur
Answered 14h 43m ago

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 ... Read More

What is the difference between a destructor and a free function in C++?

Smita Kapse
Answered 14h 46m ago

Here we will see what are the differences between destructor and the free() functions in C++. The destructor is used to perform some action, just before the object is destroyed. This action may not freeing up the memory, but can do some simple action such as displaying one message on ... Read More

Advertisements
Loading...
Unanswered Questions View All

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