KEMBAR78
C++ Class and Operator Overloading | PDF
0% found this document useful (0 votes)
9 views1 page

C++ Class and Operator Overloading

The document outlines a C++ programming assignment that includes the creation of various classes such as Car, Address, Person, Vector, Counter, Matrix, MyString, and Employee. Each class has specific attributes and member functions, with tasks including operator overloading, composition, and static members. The assignment encourages practical implementation and demonstration of these concepts through object creation and manipulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

C++ Class and Operator Overloading

The document outlines a C++ programming assignment that includes the creation of various classes such as Car, Address, Person, Vector, Counter, Matrix, MyString, and Employee. Each class has specific attributes and member functions, with tasks including operator overloading, composition, and static members. The assignment encourages practical implementation and demonstration of these concepts through object creation and manipulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

C++ Programming Assignment (Extra—for practice)

1. Define a class called Car with attributes such as make, model, and year. Include member
functions to set and get these attributes. Create an object of the Car class and demonstrate the
use of its member functions
2. Define a class called Address with attributes such as street, city, and zipCode. Create a
class called Person that has an Address object as a member variable. Demonstrate
composition by creating a Person object and accessing its Address attributes.
3. Define a class called Vector to represent a 2D vector with x and y components. Implement
operator overloading for addition (+), subtraction (-), scalar multiplication (*), and equality
(= =). Demonstrate the use of these overloaded operators by performing vector operations
4. Define a class called Counter to keep track of the number of objects created. Implement a
static member variable count and a static member function to increment it each time an object
is created. Demonstrate the use of static members by creating multiple Counter objects and
displaying the total count.
5. Define a class called Matrix to represent matrices. Implement overloaded operators for
multiplication (*) to perform matrix multiplication. Demonstrate the use of the overloaded *
operator to multiply two matrices.
6. Define a class called MyString to represent strings. Implement an overloaded + operator to
concatenate two strings. Demonstrate the use of the overloaded + operator to concatenate two
MyString objects.
7. Define a class called Employee to represent employees with attributes such as name, ID,
and salary. Implement overloaded comparison operators (<, >, ==) to compare employees
based on their salaries. Demonstrate the use of these overloaded operators to compare
Employee objects

You might also like