Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coming from C to C++ [closed]

Tags:

c++

c

oop

HI all. I have started a new job recently where I am supposed to work with C++/ I have been doing programming in C language for past 5 years. I am looking for ways to get me up to an acceptable level in OOP. I have all the basic concepts of C++ and OOP but don't have much experience of actual class designing. What I really am looking for is ways to learn class library designing as I will be working in a team who is writing C++ libraries for other programmers to use. Please suggest principles like "responsibility assignment" which can help me design classes in general.

like image 686
Aaron S Avatar asked Dec 21 '09 07:12

Aaron S


People also ask

Why does my program close automatically in C?

The problem is quite common when starting to learn C/C++.. the reason is that console applications once finisher return from their main method, the associated console window automatically closes. This behavior has nothing to do with what your app does or not, or if the app is working well or not.

What happens if you try to read from a closed file?

The “ValueError : I/O operation on closed file” error is raised when you try to read from or write to a file that has been closed. If you are using a with statement, check to make sure that your code is properly indented.

Why is my C program not showing output?

You need to put in something to halt the program so you can see the output. One way of doing it is to ask the user to press the Enter key.

Is C close to the metal?

“The C [programming language's] memory management is considered close-to-the-metal compared to other application languages because one can easily see and do mathematics on actual hardware RAM addresses (or something pretty close to them).”


1 Answers

Give a loook to Bob Martin SOLID principles:

  • SRP The Single Responsibility Principle: A class should have one, and only one, reason to change.
  • OCP The Open Closed Principle: You should be able to extend a classes behavior, without modifying it.
  • LSP The Liskov Substitution Principle: Derived classes must be substitutable for their base classes.
  • ISP The Interface Segregation Principle: Make fine grained interfaces that are client specific.
  • DIP The Dependency Inversion Principle: Depend on abstractions, not on concretions.
like image 99
philant Avatar answered Sep 19 '22 17:09

philant