TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Saturday 20 June 2020

Allocating Object In C++ | Allocating Object In C++ Program | Allocating Object In C++ Example | Allocating Object In C++ In Hindi

Allocating Object In C++


Whenever we want dynamic memory allocation on object so that time we use new keyword if that time we want to destroy the memory allocated so we  use for delete keyword. This type of object can do allocation or deletion at same time.


image of allocating object in c++
Fig:Allocating Object In C++

Synatx:

classname *pointer variable;

pointer variable=new class name;


Program:

#include<iostream.h>

#include<conio.h>

class MCA

{

int a,b;

public:

void input();

void output();

};

void  MCA::input()

{

cout<<”input two number”;

cin>>a>>b;

}

void MCA::output()

{

cout<<a<<b;

}

void main()

{

MCA *p;

p=new MCA;

p->input();

p->output();

getch();

}

 


No comments:

Post a Comment