Corning Community College
CSCS1320 C/C++ Programming
Collaborate in the creation of a useful, originally-voiced informational source on the basics of C++ programming, specifically the creation of classes and instantiation of objects, and the implementation of a simple program that has and uses a class.
The idea is to demonstrate your skills gained throughout the semester, by harnessing new concepts and problem solving experiences to delve into this new area of the course: C++ and object-oriented programming.
Additionally, the entire class will be participating in documenting and filling out this project page. It is the responsibility of EACH class member to:
In the 1960s-1990s many computer programming languages were being created for different purposes, but most of them had flaws. Some languages were easy to understand, but lacked the depth to accomplish more difficult tasks. Others had this capability, but were large, abstract, and very difficult to learn, thus leading people to create more with the goal of having a language that was not too complex, but could effectively complete difficult tasks. This eventually led to a C language that was good for low level programming, and a SIMULA language that had a class system. C++ language was the creation of Bjarne Stroustrup that combined these two.
The main difference between the two is that C is a procedural programming language, whereas C++ is a hybrid language that can perform both procedural and object oriented programming. C supports built in data types, whereas C++ can support both built-in and user defined data types. C has 32 keywords, whereas C++ has 63 keywords, and C++ supports far more things in general than C. From a security standpoint, C does not support encapsulation so data can be manipulated by outside code meanwhile C++ supports encapsulation so the data is hidden.
C++ is still updated today because it is still so widely used today, due to its speed, programming capability, and its continued popularity in being used (even if a superior language did come out computer scientists would still have to learn that new language, and languages already written in C++ would still be written in C++).
C++ is most notably used in the creation of high performance programs, such as video games, operating systems, and the Google Chrome and Firefox web browsers.
C++ is a play on the ++ increment operator in C language.
C++ was originally called 'The New C'.
C++ has influenced other programming languages such as C# and Java.
Object Oriented Programming refers to a type of programming that uses objects that contain both data and functions. This is opposed to procedural programming, which is about writing procedures or functions that perform operations. OOP has several advantages over Procedural Programming which include:
OOP is faster and easier to execute. OOP provides clear structure for programs. OOP helps make code easier to maintain, modify and debug. OOP makes it possible to create reusable applications with less code and a shorter development time.
User defined data types. Classes make it easier to work with data by providing users with the ability to create constructors, destructors, member data, member functions, and more.
In C++, you can define data inside of classes for the sake of using them with member functions. Access specifiers can be used to determine where these variables can be called from, and which functions can call them. (This is further described down below)
Methods are functions that belong to a class. The two ways to define a function that belongs to a class are inside the class definition and outside the class definition. In order to define a method outside the class definition, you must first declare it inside the class. You can then define your function outside of the class by specifying the name of the class and following it with the “::” operator. These functions are meant to be used alongside member data.
Constructors are functions that are called when an object is created. They can be used with or without parameters, similarly to any other type of function. They do not return any values.
Destructors are special functions that are called in any of the below conditions:
(1) the function ends (2) the program ends (3) a block containing local variables ends (4) a delete operator is called
They are meant to be used when a pointer is used in a class, or when memory has been dynamically allocated, in order to prevent memory leakage.
C++ classes are by default value types. Value types typically deal with memory or layout control, whereas, reference types are related to base classes and virtual functions for polymorphic purposes. A difference between the two types, is that value types are copyable, meaning, there is a copy constructor and copy assignment operator. Reference types on the other hand, make the class non-copyable, using a virtual destructor. Changing the class type is something that is done by the user/programmer, and is done by disabling the copy constructor and copy assignment operator. In short value types are about creating two values that can each be modified, whereas, reference types are more about identity.
Public members can be accessed in any part of the program.
Private members can only be accessed by members of the same class.
Protected members can be accessed by members of the same class, friend classes, and derived classes
Struct members are public by default. Class members are private by default.
Single inheritance is when one class inherits directly from one other class. This is typical for most classes. Public inheritance does not change in subclasses from the parent class. Protected inheritance refers to when anything higher than protected will be protected. Both public and protected properties will be protected in a subclass. Private inheritance takes this a step further as all three inheritance types will be made private in a subclass.
Instances of a class. Creating an object of a class works almost exactly like initializing any fundamental type; simply specify the the type name, followed by your variable's name. Objects are introduced by declarations.
Write a program that creates one or more of the following classes:
That contains, in addition to at least 2 constructors (parameterless, and a parametered), the following public member functions:
Store length, width, and any other pertinent core values as private, accessible only from the public member functions.
Have a main() function that instantiates an instance of your chosen shape class, and runs that instantiated object through a range of tests demonstrating the class works as intended (likely also prompting the user to input values to configure the attributes of the object).
https://www.learncpp.com/cpp-tutorial/public-vs-private-access-specifiers/
https://www.learncpp.com/cpp-tutorial/classes-and-class-members/
https://www.w3schools.com/cpp/cpp_classes.asp
https://www.w3schools.com/cpp/cpp_constructors.asp
https://www.geeksforgeeks.org/destructors-c/
https://docs.microsoft.com/en-us/cpp/cpp/value-types-modern-cpp?view=msvc-160
https://ofstack.com/C++/9644/example-analysis-of-access-control-in-c++-inheritance.html
https://www.w3schools.com/cpp/cpp_oop.asp
https://www.w3schools.com/cpp/cpp_class_methods.asp
https://www.geekboots.com/story/10-interesting-stories-about-c
https://www.tutorialspoint.com/difference-between-c-and-cplusplus
I'll be looking for the following:
104:oop0:final tally of results (104/104) *:oop0:no compiler messages, program compiles and runs without issue [26/26] *:oop0:specified functionality is implemented [26/26] *:oop0:project page contributions as per project specifications [52/52]
Additionally: