"classes and objects" is the base when it comes to OOP
classes in C++ are very similar to structures in C
Important points
Important points
- class members
- access modifiers
- constructor (eg. classname(){...})
- destructor (eg. ~classname(){...})
- copy constructor
- friend function
- inline function
- 'this' pointer
Concepts / Aspects / Features :
- Inheritance (parent/base class & child/derived class)
- Overloading - (The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. You can not overload function declarations that differ only by return type.)
- function overloading
- operator overloading (important aspect of C++)
- overload resolution
- Polymorphism (functions with same name but different data types of input parameters and/or return types)
- static resolution / static linkage / early binding (the call of the function is being set once by the compiler as the version defined in the base class)
- Virtual function - keyword 'virtual': (the compiler looks at the contents of the pointer instead of it's type) - dynamic linkage / late binding
- Pure Virtual Function (eg. virtual int area() = 0; //The = 0 tells the compiler that the function has no body and above virtual function will be called pure virtual function.)
- Abstraction
- interfaces
- implementations
- Encapsulation (public, private, protected)
- data encapsulation (data hiding)
- data abstraction
- Interfaces
- abstract class (class with at least one Pure Virtual function. The purpose of an abstract class is to provide an appropriate base class from which other classes can inherit. Abstract classes cannot be used to instantiate objects and serves only as an interface. )
A step further...
- namespaces
- defining namespaces
- using namespaces
- Dis-contiguous namespaces
- Nested namespaces
- templates (A template is a blueprint or formula for creating a generic class or a function. The library containers like iterators and algorithms are examples of generic programming and have been developed using template concept.)
- function template: typename
- class template: class
- dynamic memory
- new (eg. float *f1 = new float;) - The malloc() function from C, still exists in C++, but it is recommended to avoid using malloc() function. The main advantage of new over malloc() is that new doesn't just allocate memory, it constructs objects which is prime purpose of C++.
- delete
- exception handling
- try
- throw
- catch
- files and streaming
- ofstream - create and write to file
- ifstream - read information from file
- fstream - capability of both ofstream and ifstream
- open()
- close()
- signal handling
- signal() - to trap unexpected events
- raise() - generate signals
- multi threading
- create thread
- terminate thread
- passing arguments to thread
- join thread
- detach thread
No comments:
Post a Comment