Simple example of class and object
Posted: Sun Dec 08, 2019 3:12 am
I understand what is a class and object I am looking simple example of class and object in c++ for electronics project
Class is a blueprint for an object. Classes describe the type of objects. The object can be of different types: A class can have both data members and functions members associated with it.
A class is defined by:
For example There are many types of switches in market https://www.electronicshub.org/switches/
SPST Single Pole Single Throw Switch
SPDT Single Pole Double Throw Switch
DPST Double Pole Single Throw Switch
DPDT Double Pole Double Throw Switch
Push Button Switch
We can say that SPST is an object of the class known as SWITCH. It has only one pin
We can say that SPDT is an object of the class known as SWITCH. It has only three pins
I am looking meaningful examples of class and object in context of embedded programming. Can anyone give me some meaningful example of class and object in embedded programming
Class is a blueprint for an object. Classes describe the type of objects. The object can be of different types: A class can have both data members and functions members associated with it.
A class is defined by:
Code: Select all
class MyClass
{
/* public, protected and private
variables and functions */
};
SPST Single Pole Single Throw Switch
SPDT Single Pole Double Throw Switch
DPST Double Pole Single Throw Switch
DPDT Double Pole Double Throw Switch
Push Button Switch
Code: Select all
class SWITCH
{
/* public, protected and private
variables and functions */
};
We can say that SPDT is an object of the class known as SWITCH. It has only three pins
I am looking meaningful examples of class and object in context of embedded programming. Can anyone give me some meaningful example of class and object in embedded programming