What normal C constructs work differently in C++?

Answers were Sorted based on User's Feedback



What normal C constructs work differently in C++?..

Answer / guest

- Assigning int's to enum's.
- Assigning void pointers to other types of pointers.
- Function declaration foo() without parameters.
- Character constants are of type char in C++. They are of
type int in C.
- ALL functions MUST be prototyped in C++, which is not
required in C.
- In C++:
struct A { /* ... */ };
is equivalent to:
typedef struct A { /* ... */ } A;
in C.

Is This Answer Correct ?    2 Yes 0 No

What normal C constructs work differently in C++?..

Answer / achal ubbott

I just add 2 more points. C++ is a different language. Its
syntax matches to C accidentally.

1. C++ follows a name mangling algorithm for names of
functions. C does not.

2. C++ structures may have functions defined in them. Not
in C.

3. C++ follows more strict type checking.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

0 Answers  


What is the main purpose of inheritance law?

0 Answers  


Can we create object of class with private constructor?

5 Answers  


• What are the desirable attributes for memory managment?

0 Answers  


What is advantage of inheritance?

0 Answers  






what is a class

6 Answers  


What is a macro? And how is a macro same as a template?

4 Answers  


What do you mean by abstraction?

0 Answers  


What are the 5 oop principles?

0 Answers  


difine hierarchical inheritance.

9 Answers   ASD Lab, TCS,


What is a class and object?

0 Answers  


What is Inheritance, Multiple Inheritance, Shared and Repeatable Inheritance?

4 Answers   Accenture, L&T,


Categories