C/C++ :: Make Resize Function For Matrix2 Class?

Aug 29, 2013

How can we write resize function for Matrix2 class; where this function need to use Protected data members of matrix1 class? Only setters are available in Matrix 1 class but there is no getter function in Matrix1 class !

class Matrix1 {  
Protected:
int ** data;

[Code]....

View 3 Replies


ADVERTISEMENT

C++ :: Make Resize Function For Matrix2 Class?

Aug 29, 2013

class Matrix1
{
Protected:
int ** data;

[Code].....

// How can we write resize function for Matrix2 class; where this function need to use Protected data members of matrix1 class? Only setters are available in Matrix 1 class but there is no getter function in Matrix1 class !

View 1 Replies View Related

C++ ::  Dynamic Array Resize Function

Apr 22, 2014

I made a resize function for my dynamic array template class that goes as follows. Note that the private member variables are T* arr, unsigned used, and unsigned cap.

template <class T>
void darray<T>::resize(unsigned size) {
if (size > cap) {
T* temp_arr = new T[size];

[Code] ....

Whenever I use this function to increase the size of the array, it will work the first time I need to use it, but after that, Visual Studios will trigger a breakpoint at line 14, and if I continue past the breaks, I eventually get _CrtIsValidHeapPointer(pUserData) assertion failure.

View 4 Replies View Related

C++ :: Make Class Created Static Inside Another Class?

Dec 17, 2013

it seems everytime i use statics in a class i come across with a porblem.

this time i wanted to make a class i created static inside another class.

MainVariables.h file
static fge::window mWinMain;

if someone ever wants to reach it
MainVariables.cpp file

fge::window MainVariables::mWinMain;
...
...
fge::window MainVariables::GetWinMain()
{
return mWinMain;
}

but when i created some other MainVariables classes at other places instead of them reaching to the same window two window is being created.

yes i know maybe there are better methods but currently i m working on polymorphism and i need some static members.

View 2 Replies View Related

C++ :: Keyboard Function That Is Called In Main Function To Make Shape Move

Jan 19, 2013

Ok so I am working on a game and I'm in the process of developing my Player class. Anyways, what I have is a keyboard function that is called in my main function to make a shape move.

void myKeyboardFunction(unsigned char key, int x, int y) {
switch ( key ) {

[Code].....

But when I try to call it, trying to copy my previous method,

glutKeyboardFunc(Player1.playerControls);

I get an error

error C3867: 'Player::playerControls': function call missing argument list; use '&Player::playerControls' to create a pointer to member

I get an error saying it can't convert parameters. I would just like to understand why the arguments become a problem when I make the function a member of my class, when the first method I used is so easy.

View 2 Replies View Related

C++ :: Member Function In Derived Class Call Same Function From Its Base Class?

Sep 18, 2013

How can a member function in my derived class call the same function from its base class?

View 1 Replies View Related

C++ :: Can't Seem To Make STL Iterator Class

May 24, 2013

I can't seem to make the STL iterator class work how I need it to.I am implementing a multi list graph and I need to iterate through my STL list of Vertex pointer objects. I keep getting the error:

Error 1 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_List_iterator<_Mylist>' (or there is no acceptable conversion) and the same for != for my terminating condition.

template <typename V, typename E>
void Graph<V, E>::InsertEdge(V from, V to, E edge) {
list<Vertex<V>*>::iterator iter;
for(iter = m_Vertices.begin(); iter != m_Vertices.end(); ++iter)

[code].....

View 2 Replies View Related

C++ :: How To Make A Class Final

Oct 5, 2013

Just mark the destructor final: [URL] ....

Well, sort of - my question is, since the destructor has to be virtual in order to be marked final (you get an error otherwise), does this cause virtual function overhead anywhere, or add a vtable?

View 9 Replies View Related

C++ :: Make Class For 2D Array

Mar 20, 2014

I want to make Class for 2D array.

This is part of Class Definition.

class CMatrix{
public:
explicit CMatrix( int rows, int cols ){
m_pArray = new float[ rows * cols ];
m_nRows = rows;

[Code].....

View 6 Replies View Related

C :: Can't Get Array To Resize

Jan 6, 2015

I have an array of blocked users and I want to be able to increase the element size every time a new user is to be blocked.

The blockedUsers array and blockedCount int are global varaibles

Code:
int blockedCount = 0;
char ** blockedUsers; Code: int blockUser(char *username)
{
int i = 0;

[Code]....

View 11 Replies View Related

C++ :: How To Make Class Globally Accessible

Aug 8, 2013

I have a class like this:

file one :

Code:
class X : public Y {
public:
virtual int query(int, int);
// constructor
X(int, int);

[Code] .....

And i construct my M and Nby calling :

Code:
X Y(a,b); and afterwords by calling

Code:
result = Y (c,d) i get my result.

The problem is I need to be able to call result = Y (c,d) from outside my main function and get results but i don't know how to do this. So I want to be able to do something like this.

Code:
#include <iostream>
int g;
void func2(int *h){
*h = g;

[Code] .....

View 7 Replies View Related

C++ :: Make A Class Without Any Data Member?

Aug 18, 2013

can we make a class without any data member ? but it may have member functions ! in c++

View 2 Replies View Related

C++ :: How To Make Array Of Objects For Class

Aug 18, 2013

class A {
Public:
A (int);
A(int,int);
int get (int,int);
};

View 5 Replies View Related

C/C++ :: Make Class That Can Only Have One Object Of It Created?

Oct 7, 2014

make a class that you can make only one Object of it.

For example if you have Class A.
Let's say you create one object A* a=new A();

Now the next time you, try to create another object. For example:

A* b=new A(); What will happen is that b will get the same object (or reference) as a. In other words hey'll be pointing towards the same place. So basically you'll only have one object of it created. I tried doing it but I couldn't quite make it.

Here is what I tried: (but couldn't complete the exercise)

class God
{
public:
static int num;
static God* god;

[Code]....

View 2 Replies View Related

C# :: How To Combine 2 Methods To Make SQL Class

Jun 17, 2014

I am given 2 methods and they want me to create a stand alone class for sql that will change the sql string.

my question is how can i take these 2 methods and make one class out of them that will used on various other forms.

#1

public string AuthenticateWithDB(CUiPontisDatabaseSpecification pdb, string sUserId, string sPassword,
bool bCreatePersistentCookie)

#2

public static void ChangeConnection(Util.ODBC.ODBCDSN odbcInfo, CPonDatabaseVendorType dbType, string uid, string password)

they want it so they can use it like

CUiHttpSessionManager.SimpleDataConnectionString = SomeNewClass.CreateSimpleDataConnectionString()

where some new class is my new class

View 5 Replies View Related

C Sharp :: Make A Program Without Using Class

Apr 22, 2012

Is there any way or trick to make a program that executes without using any class or class concept

View 4 Replies View Related

C/C++ :: Make Class Without Any Data Member?

Aug 18, 2013

is this possible to make a class without any data member in c++ ?

View 1 Replies View Related

C :: Resize A Bitmap Image

Aug 22, 2014

I am trying to re-size a bitmap image for a class.They gave us two options to use to do the program with: an array or move the file position indicator. I want to use the file option. All the bitmap header info is checking out. The file after being re-sized should be 822 bytes but it is 1.6 KiB and the image is distorted.

Code:

#include <stdint.h>
/**
* Common Data Types
*
* The data types in this section are essentially aliases for C/C++
* primitive data types.

[Code]...

View 2 Replies View Related

C++ :: How To Make A Class Non Inheritable Without Using Keyword Final

Apr 13, 2013

how can I make a class non inheritable,,, without using keyword "final" ?

class A
{
//
};
A obj; // No error
class B : public A
{
//
}; // error

View 2 Replies View Related

C++ ::  How To Make Private Member Accessible Outside Class

Aug 9, 2013

The question says that:

#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>

[Code].....

But then the 2nd part of the question itself says that "Acno entered by the user". So we need to identify/search for an account with that Account Number. How can we do this without comparing Acno with S.Acno? I know that S.Acno is not accesible as it is a private member but then how to compare Acno without even using a member function(public) that can return the value of Acno?

View 11 Replies View Related

C++ :: Vector Syntax - Resize And Reserve

Mar 7, 2014

We can construct vector in following ways

vector<int>v1; //create an empty vector
vector<int>v2(arr,arr+4); ///to create vector from an array
vector<int<v3(v2); //throuh copy constructor

But I have come across some program in a forum,they have create vector like this

vector<int>v(10,5)

I am clueless ,is this allowed?,what syntax allows this?

if a vector is create like this

vector<int>v(3);
v.push_back(1);
v.push_back(2);
v.push_back(3)
v.resize(2);

Now I am curious to know what are the changes those will happen in vector v because of resizing it?

View 1 Replies View Related

C++ :: Set Vector Step Length When Resize?

Jan 5, 2013

When I use vectory.push_back(obj), if the length is out of reserved bound, it will deallocate the whole vector and reallocate a big piece of memory. From my understanding I think c++ only allocates 1 more place for the new obj. This is quite inefficient. Is there a way to set the step length whenever the size is out of bound? e.g. 50 more spaces.

View 6 Replies View Related

C# :: Resize Quadrilateral Image According To New Points

Nov 22, 2014

I have a bit map which I wants to re-size according to new point. But on Paint Event Method getting error not Implemented.

CODE Under Paint Event Method

private void pictureBox3_Paint(object sender, PaintEventArgs e) {
Point[] destinationPoints = {new Point(200, 20),new Point(110, 100),new Point(250, 30), new Point(250, 30) };
Image image = new Bitmap("D:\APP\Resources\MyPic.Png");
// Draw the image mapped to the parallelogram.
e.Graphics.DrawImage(image, destinationPoints);
}

View 5 Replies View Related

C# :: Keep Aspect Ratio When Resize Form

Dec 15, 2014

When I try to resize my form, every time i try to resize it while running, the window blinks between original size and the new size it was given, when i release the mouse it either stay in its new size or shrinks back to its original size, What makes it return to its original size, maybe its something with the form_Resize function..

private bool inForm_Resize = false;
private Size PrevSize;
private void Form1_Resize(object sender, EventArgs e) {
double dRatio = 1.6;
if (!inForm_Resize) {
inForm_Resize = true;

[Code] ....

View 3 Replies View Related

Visual C++ :: CDialog Resize In One Direction

Oct 27, 2014

Is there any way to allow user to resize a CDialog only in one direction ? I mean, by width, but not by height ? How ? I noticed that overriding WM_SIZE, I can do nothing about this issue ...

View 2 Replies View Related

Visual C++ :: Program To Resize Image?

Feb 19, 2013

I am currently working on problem set 4 for Harvard's online CS50 course. I am working on a program that resizes a bmp image by a factor of N. N in entered along with an in-file and out-file in a command line argument. The program needs to calculate the header file for the out-file and write it to the out-file. It then needs to actually resize the image and, again, write to the out-file.

The first question I have relates to the header file, here is my code for calculating the header file:

bi2.biHeight = bi.biHeight *n;
bi2.biWidth = bi.biWidth *n;
int padding = (4 -(bi.biWidth * sizeof(RGBTRIPLE))%4)%4;
bi2.biSizeImage = (bi2.biWidth * sizeof(RGBTRIPLE) + padding) * abs(bi2.biHeight);
bf2.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bi2.biSizeImage;

And here is my code for writing the new header file (bi2 and bf2) to the out-file:

fwrite(&bf2, sizeof(BITMAPFILEHEADER), 1, outptr);
fwrite(&bi2, sizeof(BITMAPINFOHEADER), 1, outptr);

At this point I need to actually resize the image. As far as I can tell there are 2 ways to go about this you either have to use an array to store each line you want to print repeatedly (and then you can just write it repeatedly) OR you have to move the pointer back in the input stream and repeat the read/resize/write process each time you need to print the row.

It is this that I am stuck on, first of all, I am not sure what system would be better for resizing the image, although I am leaning towards using an array, and regardless, I don't even know where to begin when in implementing either.

So what I am asking for is, first of all, just a "double check" to make sure my header code makes sense. And second of all, a push in the right direction for actually resizing the image. Here is my complete code:

/****************************************************************************
* resize.c
*
* Resizes a BMP piece by piece, just because.
***************************************************************************/

#include
#include
#include "bmp.h"
int main(int argc, char* argv[]) {
// ensure proper usage
if (argc != 4) {
printf("Usage: copy N infile outfile

[Code]....

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved