What is Object and Class? What are the differences between
them?
Answers were Sorted based on User's Feedback
Answer / jack
simple analogy for this quest is u declare int x;
and u ask diff between int and x;
Object is an instance of a class.......
--when an object of a class is created the memory for
that class is created...
--U can access the class members using the . operator in
your program....but u r not allowed to access the private
and protected members, which can be accessed by the member
functions only........
Class is the user defined datatype...which contains data
members and member functions.....
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / pankaj vashishta
Class is template for creating similar type of entities.
Class doesn't take memory space untill it contains static
members.
In a specific Class, you declare the attributes(field
variables) and its behaviour(functions).
But Class doesn't have any state and identity.
Objects are the real time entity which are created through
their template, thier class.
By real time entity, I mean they would occupy a memory
space in which they will save the values of its atrributes.
These values create a state of an object.
Since Object occupy a space in memory so they have unique
address in memory. This become the identity of an object.
For example : Pen is a class, which has weight and color as
its attribute. They may have behaviour like write().
Still they don't occupy a space in memory.
When I say My pen ,It will be an object of class Pen since
it will have some values for weight like 10 gm and color
like blue. This will occupy some memory to save these
values.
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / kalaivani
object-run time entity
class- bind of function & data
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / prabhakar
class is a collection of data and member functions.
objcet is instance of a class
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / poorna chandar rao
Object and Class both are same there is no difference
bettwen them those are having properties(data) and methods
but small difference beteween them that is objects are
available physically avialable and class is not avialable
class is a bluprint
Is This Answer Correct ? | 0 Yes | 3 No |
what is costructor?
What are the fields of vtable
what is the difference between containership and inheritence?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
what is oops
Why static Function is used in C++?
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.
What are the benefits of polymorphism?
what is runtime polymorphism? For the 5 marks.
#include <string.h> #include <stdio.h> #include <stdlib.h> #include<conio.h> void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
What is virtual function?where and when is it used?