Define classes and objects, C/C++ Programming

Assignment Help:

Classes and Objects

A class is a vehicle to execute the OOP features in the C++ language. Once a class is declared, an object of that type can be explained. An object is said to be a specific instance of a class just like Maruti car is an instance of a vehicle or pigeon is the instance of a bird. Once a class has been explained several objects of that type can be declared. For instance, an object of the class defined above can be declared with the following statement:

                                player Sachin, Dravid, Mohan ;

                                                [Or]

     class player Sachin , Dravid, Mohan ;

where Sachin and Dravid are two objects of the class player. Both the objects have their own set of member variables. Once the object is declared, its public members can be accessed using the dot operator with the name of the object. We can also use the variable no_player in the public section with a dot operator in  functions other than the functions declared in the public section of the class.

e.g.

                Sachin.getstats();

                Dravid.showstats();

                Mohan.no_player = 10;

 


Related Discussions:- Define classes and objects

Area under curve, a program to find the area under curve y=f(x) between x=a...

a program to find the area under curve y=f(x) between x=a and x=b,integrate y=f(x) between the limits of a and b.

Define generic bitwise operations, Define Generic Bitwise Operations? ...

Define Generic Bitwise Operations? Bitwise operators only work on an incomplete number of types int and char. It turns out there's above one kind of int. In particular there's

Random question, Ask question #write statement that assign random integer t...

Ask question #write statement that assign random integer to the varaible n in the (100

C program for bubble sort, C program for bubble sort: void main() {...

C program for bubble sort: void main() { int i,j,k,a[10],n; clrscr(); printf("How many values you want to enter\n"); scanf("%d",&n);  for(i=0;i  {  pri

What is scope resolution operator, Scope Resolution operator: The scope...

Scope Resolution operator: The scope resolution operator: : is used to access global variable in the inner block. When global and local variable are identical name the scope re

C++ programming, I need help programing this... In this exercise, you will ...

I need help programing this... In this exercise, you will create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local comp

If one won''t explicitly call the destructor of a local then , if one won't...

if one won't explicitly call the destructor of a local; then how does he handle the above situation?

Define and explain flow chart with an example, C Programming and Data Struc...

C Programming and Data Structures 1. Define and explain flow chart with an example. 2. Write an algorithm to print all even numbers in descending order and draw the flowcha

How to insert values in array - c++ program, How to insert values in array ...

How to insert values in array - c++ program: Write a program to insert values in array void main() { int a[2][3][2]={                                 {

C program for dynamic data structure(linked list), Aim: To implement a pro...

Aim: To implement a program for dynamic data structure(linked list). Code:                       class node {             int data;             node *next;

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd