Contenido del Curso
C++ OOP
C++ OOP
Attributes of the Class
Class is like a container for two primary elements: attributes and methods. In this chapter we will learn about attributes and how to use them. For a student class common attributes will be name, gpa, email etc.
Understanding Attributes
Attributes, also often referred as properties or fields, they are the variables that are held within a class. Their job is to represent the state or qualities of objects created from the class.
Public attributes and methods in a class can be directly accessed using the dot operator (.
) on an object of the class.
main
class Example { public: float attribute; }; int main() { Example obj; obj.attribute = 25; }
Note
Don't be bothered about public keyword. It will be explained later.
Tarea
- Add two more attributes to a student class.
- Create an object of the class.
- Assigned values to the attributes of created instance.
¡Gracias por tus comentarios!
Attributes of the Class
Class is like a container for two primary elements: attributes and methods. In this chapter we will learn about attributes and how to use them. For a student class common attributes will be name, gpa, email etc.
Understanding Attributes
Attributes, also often referred as properties or fields, they are the variables that are held within a class. Their job is to represent the state or qualities of objects created from the class.
Public attributes and methods in a class can be directly accessed using the dot operator (.
) on an object of the class.
main
class Example { public: float attribute; }; int main() { Example obj; obj.attribute = 25; }
Note
Don't be bothered about public keyword. It will be explained later.
Tarea
- Add two more attributes to a student class.
- Create an object of the class.
- Assigned values to the attributes of created instance.
¡Gracias por tus comentarios!
Attributes of the Class
Class is like a container for two primary elements: attributes and methods. In this chapter we will learn about attributes and how to use them. For a student class common attributes will be name, gpa, email etc.
Understanding Attributes
Attributes, also often referred as properties or fields, they are the variables that are held within a class. Their job is to represent the state or qualities of objects created from the class.
Public attributes and methods in a class can be directly accessed using the dot operator (.
) on an object of the class.
main
class Example { public: float attribute; }; int main() { Example obj; obj.attribute = 25; }
Note
Don't be bothered about public keyword. It will be explained later.
Tarea
- Add two more attributes to a student class.
- Create an object of the class.
- Assigned values to the attributes of created instance.
¡Gracias por tus comentarios!
Class is like a container for two primary elements: attributes and methods. In this chapter we will learn about attributes and how to use them. For a student class common attributes will be name, gpa, email etc.
Understanding Attributes
Attributes, also often referred as properties or fields, they are the variables that are held within a class. Their job is to represent the state or qualities of objects created from the class.
Public attributes and methods in a class can be directly accessed using the dot operator (.
) on an object of the class.
main
class Example { public: float attribute; }; int main() { Example obj; obj.attribute = 25; }
Note
Don't be bothered about public keyword. It will be explained later.
Tarea
- Add two more attributes to a student class.
- Create an object of the class.
- Assigned values to the attributes of created instance.