C Reference Tutorial LEARNOVITA

C++ Reference Tutorial | A Comprehensive Guide for Beginners

Last updated on 11th Aug 2022, Blog, Tutorials

About author

Boopathy krishna (C++ Developer )

Boopathy Krishna is a professional with 7+ years of experience in their respective domain. He has expertise in C, C++, Java, Hibernate, Springboot, JSP development, CSS, JavaScript, HTML, AJAX, jQuery, EXTJS, OSGi/FELIX, and CMS development experience.

(5.0) | 18574 Ratings 2181

C++ is a general-purpose programming language and used nowadays for competitive programming.

It can run imperative, object-oriented, and generic code.

C++ runs on lots of platforms such as Windows, Linux, Unix, Mac, etc.

But there are the benefits and drawbacks of C++ on the idea of which will start the new journey of programming.

It is one of the oldest and more effective languages that also continues to dominate the realm of programming.

C++ Language Reference

It defines the C++ programming language as implemented in the Microsoft C++ compiler.

The company is based on The Annotated C++ Reference Manual by Margaret Ellis and Bjarne Stroustrup and on the ANSI/ISO C++

International Standard (ISO/IEC FDIS 14882).

Microsoft-particular implementations of C++ language features are included.

An alias, or alternative name for a variable that already exists, is a reference variable.

Once a reference is initialized with a variable, the variable name or the reference name may be used to refer to the variable.

References vs Pointers

Reference vs Pointers
References are often confused with pointers but 3 main differences between references and pointers are
  • Cannot have NULL references must always be able to assume that a reference refers to a valid piece of storage
  • Once a reference is started to an object, it cannot be changed to refer to another object.
  • Pointers can be pointed to other objects at any time.
  • A reference must be started when it is created.
  • Pointers can be started at any time
See the following tables to rapidly find a keyword or operator:
  • C++ Keywords
  • C++ Operators

Lexical Conventions

Tokens, comments, operators, keywords, punctuators, and literals are the basic lexical components of a C++ programme.

File translation, operator precedence/associativity.

Basic Concepts:

Scope, linkage, program startup and termination, storage classes, and types.

Built-in types The fundamental types are built into the C++ compiler and the value ranges.

Standard Conversions

  • Type conversions between built-in types.
  • Arithmetic conversions and the conversions among pointer, reference, and pointer-to-member types.
  • Declarations and explanations Declaring and defining variables, types and functions.
  • Operators, Precedence and the Associativity
  • The operators in C++.

Expressions

Types of expressions, semantics of expressions, reference topics on operators, casting and casting the operators, run-time type information.

Lambda Expressions

A programming technique that implicitly explains a function object class and constructs a function object of that class type.

Statements

Expression, null, compound, selection, iteration,and declaration statements.

Classes and structs

Introduction to the classes, structures, and unions.

The member functions, special member functions, data members, bit fields, this pointer, nested classes.

Unions

User-defined types in which all the members share the same memory location.

Derived Classes

Single and multiple inheritance, virtual functions, multiple base classes, abstract classes, and scope rules are all examples of inheritance.

The __super and __interface keywords.

Member-Access Control

Controlling access to the class members: public, private, and protected keywords.

Friend functions and classes.

Overloading

Overloaded operators, rules for the operator overloading.

Exception Handling

The C++ exception handling, structured exception handling (SEH), keywords used in writing exception handling statements.

Assertion and User-Supplied Messages

#error directive, static_assert keyword, the assert macro.

Templates

Template descriptions, function and class definitions, the typename keyword, the comparison of templates and macros, and smart pointers.

Event Handling

Declaring the events and event handlers.

Microsoft-Specific Modifiers

Modifiers denote Microsoft C++. Memory addressing, calling conventions, naked functions, extended storage-class attributes (__declspec), __w64.

Combined Assembler

__asm blocks in C++ and assembly code are employed.

COM Compiler Support

A reference of the global functions and classes specific to Microsoft that are utilized to support COM types.

Microsoft Extensions

The Microsoft extensions to C++

Nonstandard Behavior

Information about the nonstandard behavior of the Microsoft C++ compiler.

Welcome Back to C++

A summary of current C++ programming techniques for creating reliable, accurate, and effective programs.

Additional Sections

Runtime Platform Extensions for Components

.NET-targeting reference information for the Microsoft C++ compiler.

Building Reference for C/C++

Choices for linkers, compilers, and other build tools.

Preprocessor Reference for C/C++

Pragmas, preprocessor directives, preset macros, and the preprocessor are all topics of reference.

Library for Visual C++

A collection of links to the reference pages for the various Microsoft C++ libraries appears at the top of each page.

Basic Concepts (C++)

This section defines concepts that are critical to understanding C++.

C programmers will be famous with many of these concepts, but there are some subtle differences that can cause unexpected program results. The following topics are included:

  • C++ type system
  • Scope
  • Translation units and linkage
  • main function and command-line arguments
  • Program termination
  • Lvalues and rvalues
  • Temporary objects
  • Alignment
  • Trivial, standard-layout and POD types

Reference variables have advantages over pointer variables in C++:

  • While pointer variables are a specific form of variable that contains the address of another variable, reference variables are the alias of other variables.
  • Pointers and references both provide direct access to the variable and can be used to refer to it.
  • However, references have several benefits over pointer variables, these are: In pointers –

    To access the value of actual variable, need to explicitly dereference the pointer variable by using ‘value at address’ operator/ dereferencing operator (*).

    In references –

    To access the value of an actual variable, you do not need to explicitly dereference the reference variable, it gets de-referenced automatically.

    The Reference variables are cleaner and modish as compared to the pointers; they can also be used while passing in the function as arguments, known as call by references.

    • #include
    • using namespace std;
    • int main()
    • {
    • int a=10;
    • int &ref_a=a;
    • ref_a=100;
    • return 0;
    • }

    Advantages of C++:

    Advantages Of C++
    • A language for object-oriented programming is C++. It might be a collection of instructions telling the computer to try to accomplish “something.”
    • Common names for this set of instructions are C++ ASCII text files. Compared to other low-level languages like binary coding, C++ may also be a problem-oriented language that is considerably easier to use.
    • It takes more space than low-level languages but it’s much simpler to understand and learn.
    • The C + + program has more advantages when it involves programming. All C++ program stand-alone files must use the foremost function to allow the program to initiate out up and motivate its functions.
    • C++ programs can encourage unions and structures that are a mix of stand-alone and put-together files. It employs the standard C++ programme known as “.cpp,” C++ employs the reserved library term known as “goto,” which is the same as Java continue.
    • The global data and global functions are used within C++ that are not utilized in many other high-level languages within the pc sciences and it is an advantage to the programming languages.
    • As C++ doesn’t use the objects, it’s complex to make the programs that have inheritance data and thus the reformed the programs to contribute to the other data and therefore the programs, it is possible to undertake to the present, but is difficult, These inheritance data and programs are mentioned because of the inheritance trees.
    • C++ doesn’t support class methods that are faithful away, but class methods are basically functions, and sometimes they are referred to as functions.
    • Multi-paradigm programming is used in C++ programmes. The planning of programming is known as a paradigm, and a paradigm is concerned with the logic, the structure, and the process of a programme. C++ program is multi-paradigm if it adheres to the Generic, Imperative, and Object-Oriented paradigms.
    • C++ program is useful for low-level programming language and efficient for general purposes, It offers performance and memory efficiently, It provide high-level abstraction, within the language of matter domain C++ is a system programming language with a generally clear and established standard.
    • C++ program supports inline function, C++ supports exception handling, pointer and references, C++ uses cin and cout.

    Disadvantages of C++:

    • One main problem in C++ is when the info points to an equivalent thing from two various starting points, this causes a serious problem, the C++ program will still have involved problems within the coding.
    • Java’s unicode to the ASCII rules is 16-bit, while C++ program is 8-bit only, So, C++ is a less impressive programming language but stores the memory.
    • C++ program is difficult during a very large high-level program, C++ is employed for platform-specific applications commonly, For the actual OS or platform, the library set is typically chosen.
    • C++ program cannot support garbage pickup. It does not support Dynamic Memory Allocation, it is not secure since it has a pointer, friend function, and global variable, and it lacks thread support.
    • C++ programs are heavy if it’s not careful, C++ programs allow classes and thus the functions with an equivalent name and overloaded functions thus the symbol mangling system must be used, It can be simply wrapped in C functions though.
    • C++ program has no notion of being fast and it’s not used for platform-dependent apps any longer than C or anything is given the character of the toolchain, it’s probably less dependent than others. difficult in a very large high-level program.
    • It is used for platform- particular applications.
    • For a particular OS or platform, the library set is typically chosen that locks.

    Are you looking training with Right Jobs?

    Contact Us

    Popular Courses