C# Constructor

In C#, a constructor is the member of the class and is automatically invoked once the object of the class is created. It is like a method in a program and is used for the initialization of the data members of a newly created object. Two types of C# constructors Default constructor Parameterized constructor Default Constructor … Read more

C# Object and Class

C# is an object-oriented programming language and classes and objects are the fundamental components of OOP’s. Everything in C# is built upon classes and objects. Let us learn classes and objects with an example. C# Class A class is a user-defined blueprint or prototype for creating Objects. We can say that it is a template for … Read more

C++ Exception Handling

An exception is an event or an error that arises during the execution of a program i.e. during run–time. The occurrence of an exception in a program disrupts the normal flow of instructions. So to handle such errors, we use exception handlers. If we do not handle the exception properly then the program may terminate. … Read more

C++ Strings

A string is a sequence of characters that is an object of std::string class in C++. Memory to a string is allocated dynamically that is we can assign memory during runtime as required. Various operations are performed on a string such as concatenation, comparison, conversion, etc. C++ supports two types of string in a program. C-style character … Read more

C++ Preprocessor

As you have studied in C preprocessor before, C++ preprocessor also has the same exact concept of it with a change in coding. As the “pre” means beforehand, similarly it means processing something before passing it on further. The preprocessor is a program that processes the source program before it is passed to the compiler. … Read more

C++ Namespaces

Suppose there is a function called abc() in your code and you are also using some library that has the function with the same name as abc(). Now while executing these functions, the compiler will not know which one to execute among two abs() functions. In such cases namespace comes into action. A namespace is … Read more

C++ Files and Streams

Till now, we have seen the use of iostream standard library that provides us with cin and cout methods to take input and print output respectively. Here we will learn about another library to handle files. Files are used to store the data permanently in the storage device and a standard C++ library called fstream allows us … Read more

C++ Enumeration

An enumeration is a user-defined type that consists of a set of named integral constants. These constants are fixed constant. The keyword enum is used to define these data types. Syntax of enums enum enum_name{const1, const2, ……. }; enum_name: Name of the enum given by the user. const1, const2 : These are the value of … Read more

C++ Structure and Function

The relation of structure and function in C++ is that just like any other argument passed in a function, a structure can also be passed. Passing structure to function in C++ We can pass and access the structure to function as an argument in a program. It is similar to the way we pass a … Read more

C++ Pointer to Structure

A pointer in C++ can also be created for a user-defined type like structure. It is similar to those pointers that point to the native data types such as int, float, etc. Visit pointers and structures to learn more about them. Creating pointer for structures: We create a pointer for structure in the same way … Read more