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

Decoding, how to decode a number from mobile keypad

how to decode a number from mobile keypad

Define the return statement in computer programming, Define The Return Stat...

Define The Return Statement in Computer Programming? The return statement is used for two purposes once the return statement is executed the program control will be immediately

Padovan string, write a program that counts the number of occurrences of th...

write a program that counts the number of occurrences of the string in the n-th Padovan string P(n)   program in java // aakash , suraj , prem sasi kumar kamaraj college

Build a standalone module to extract and parse, A skilled programmer is req...

A skilled programmer is required to build a standalone module to extract, parse and store in database tables, word count data from web pages and RSS feeds. The module will take

C program for maximum no, C Program for MAXIMUM NO, MINIMUM NO AND SORTING ...

C Program for MAXIMUM NO, MINIMUM NO AND SORTING   void main() {           int i,j,t;           int a[5];           clrscr();           for(i=0;i

Prepare aime crossover alert expert adviso, Prepare aime crossover alert ex...

Prepare aime crossover alert expert adviso Project Description: Need to develop an expert advisor base on aime crossover alert indicator. Skills required is C Programming

What is abstraction in c++, Abstraction is of the process of hiding unwante...

Abstraction is of the process of hiding unwanted details from the user

Program create a user defined data structure - c++ program, Create a user-d...

Create a user-defined data structure (struct) called Node that represents a node within a linked list where the "data" stored in each node is a pointer to a Car object.    a) Wr

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

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

Padovan string, padovan string generation till 40

padovan string generation till 40

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