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

Inheritance and friendship in C++

Answered 16h 11m ago, 0 Views

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 display() can access the private member of MyBaseClass. , ,

Can main() be overloaded in C++?

Answered 16h 18m ago, 0 Views

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. , , To overcome the main() function, we can use them as class member. The main is not a restricted keyword like C in C++. , ,

Use of explicit keyword in C++

Answered 16h 30m ago, 0 Views

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. , , This is working fine because we know that if one constructor can be called using one argument only, then it will be converted into conversion constructor. But we can avoid this kind of conversion, as this may generate some unreliable r.....

static keyword in C++ vs Java

Answered 16h 41m ago, 0 Views

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 members are the property of the class, and it is shared to all of the objects. , , , , The static member functions.....

What is the C++ equivalent of sprintf?

Answered 16h 57m ago, 0 Views

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. This ostringstream is basically the output string stream. This is present in the sstrem header file. Let us see ho.....

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

Answered 17h 2m ago, 0 Views

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 screen. The free() function is used in C, in C++, we can do the same thing using delete keyword also. When t.....

What does it mean when a numeric constant in C/C++ is prefixed with a 0?

Answered 17h 13m ago, 0 Views

Sometimes we may see some numeric literals, which is prefixed with 0. This indicates that the number is octal number. So octal literals contain 0 at the beginning. For example, if an octal number is 25, then we have to write 025. , ,

Why strict aliasing is required in C?

Answered 17h 20m ago, 0 Views

Here we will see, why we should use the strict aliasing in C. Before discussing that part, let us see one code, and try to analyze the output. , , If we call the function my_function, then it will return 1. We can also call this using my_function((double*)&temp). This is supposed to return 1, but here we can see that this is returning something else. This code was made to return constan.....

What is data type of FILE in C?

Answered 17h 30m ago, 0 Views

In C we have used Files. To handle files, we use the pointer of type FILE. So the FILE is a datatype. This is called the Opaque datatype. So its implementation is hidden. The definition of the FILE is system specific. This is the definition of FILE in Ubuntu System − , Now let us see one example using FILE. , , ,

Incompatibilities between C and C++

Answered 17h 36m ago, 0 Views

Here we will see some incompatibilities between C and C++. Some C codes that can be compiled using C compiler, but does not compile in C++ compiler. And also returns error. We can define function using a syntax, that optionally specify the argument types after the argument list., , , In C, or some older version of C++, the default variable type is integer. But in newer C++, it will generate.....

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

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