Are classes in c++ like libraries in c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Are classes in c++ like libraries in c?

In classes you write attributes and behaviour of a variable tipe (e.g. library <stdbool.h> in c that allows you to create bool type variables) and you can write functions in classes (e.g. library <stdio.h> that contains printf and scanf functions). Pls tell me if I am wrong

29th Mar 2017, 1:46 PM
infinity
infinity - avatar
1 Answer
+ 17
Libraries, stored inside header files, consist of classes and functions. Are classes like libraries? - Not really. Libraries are made up of classes, each for different purposes. While the concept of libraries and header files are similar in C and C++, libraries in C only contain functions, whereas libraries in C++ may contain both classes and functions.
29th Mar 2017, 3:08 PM
Hatsy Rei
Hatsy Rei - avatar