What is the differances between a abstract calss and
interface
Answers were Sorted based on User's Feedback
An abstract class holds both method prototpypes and method
definitions also...But it is not in the case of
interface..It can contain only protypes.. It should be
defined only where it is implemented...
| Is This Answer Correct ? | 20 Yes | 3 No |
Answer / abhijit
Abstract base classes can have data members but not interfaces.
Abstract base classes have private access specifier by
default while that of interfaces is public
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / porchelvi .a
ABTRACT CLASS:
-------------
• It can not be instantiated
• It allow us to specify all access modifier except
Private
• A class inheriting this must implement all of its
abstract method
• A class can inherit only one abstract class at a
time.
• Abstract class can add more functionality with out
destroying child classes that were using old version.
• We can declare the following
1. Fields
2. Constructors
3. Static Constructors
4. Static Functions
5. Concrete Functions
INTERFACE :
---------
• It can not be instantiated
• It allows only public Access modifier
• A class implementing interface must provide body
for its entire member.
• A class can implement more than one interface at a
time.
• Adding of additional functionality will have an
effect on its child class due to the necessary
implementation of interface methods.
• We can not declare the following
1. Fields
2. Constructors
3. Static Constructors
4. Static Functions
5. Concrete Functions
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / rck
Abstract class is the class which may contain pure virtual
functions as well as normal functions where as interface
may only contain pure virtual functions.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / kanan
Abstract class: You can inherit only one class.
Interface: You can inherit more than one interface.
Abstract class: It contains both completed and uncompleted
(abstract) methods.
Interface: It only contains uncompleted methods (methods
without body).
Abstract class: Access modifiers are there for methods and
properties.
Interface: It does not have access modifier for methods or
properties. By default they are public.
Abstract class: Fast
Interface: Require more time to find actual method in classes.
Abstract class: It can contain fields and constants.
Interface: no fields can be defining in interface.
| Is This Answer Correct ? | 3 Yes | 0 No |
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is static modifier?
#include <stdio.h> #include <alloc.h> #include <stdlib.h> #include <conio.h> void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.
what is the technical or oop name of object?
What is this pointer in oop?
Given two strings like x=?hello? and y=?open?, remove any character from string x which is also used in string y, thus making the result x=?hll?.
can you give real time example for polymarphism
What is object in oop?
What is a null tree?
What is namespace?
What language is oop?
Which method cannot be overridden?